Reading
Read the section entitled "Methods That Send Values Back" starting on page 36 to the top of page 39.
Code
Add the method "NumberOfLegs" to your class and call it from your Main method.
Hint: You can copy the method from the book and paste it into your class, but it must be put in the right place.
Be sure to build the project, then run it. Set a breakpoint in your new method and step through the code line by line and understand how it works.
Monday, July 7, 2008
Thursday, July 3, 2008
More About Methods
Reading
Read the section entitled "More About Methods" starting on page 33. Read up to the section entitled "Methods That Send Values Back" on page 36.
Code
Revise your SayHello method to take a string parameter called someName, and use the someName parameter in your method. See an example of this near the bottom of page 34.
In your Main method of the Program class, modifiy the what you call the SayHello method to take the string parameter.
Read the section entitled "More About Methods" starting on page 33. Read up to the section entitled "Methods That Send Values Back" on page 36.
Code
Revise your SayHello method to take a string parameter called someName, and use the someName parameter in your method. See an example of this near the bottom of page 34.
In your Main method of the Program class, modifiy the what you call the SayHello method to take the string parameter.
Wednesday, July 2, 2008
Methods
Reading
Read from the bottom of page 28 (Methods) to to top of page 33.
Code
Add a method called SayHello to your Animal class, and call it from your Main method, Your SayHello method should be just like you see on page 30. Remember that to call it, you must say animalvariablexxx.SayHello(); where animalvariablexxx is the name of your declared Animal variable.
Read from the bottom of page 28 (Methods) to to top of page 33.
Code
Add a method called SayHello to your Animal class, and call it from your Main method, Your SayHello method should be just like you see on page 30. Remember that to call it, you must say animalvariablexxx.SayHello(); where animalvariablexxx is the name of your declared Animal variable.
Sunday, June 29, 2008
Private, Protected, and Public Fields
Reading
Read pages 26 through the bottom of page 28. Undestand the picture and its associated description on page 27.
Code
Add the public/private key words to your animal class in the Claass project as you see on page 27. Then try to access the fields of your animal class from your Main function.
Read pages 26 through the bottom of page 28. Undestand the picture and its associated description on page 27.
Code
Add the public/private key words to your animal class in the Claass project as you see on page 27. Then try to access the fields of your animal class from your Main function.
Friday, June 27, 2008
Class and Fields Re-visited
Reading
Re-read pages 13 through 25 of C# for Sharp Kids.
Code
Re-read pages 13 through 25 of C# for Sharp Kids.
Code
- Create a new console application called Classes. Add a new class called Animal. (Project->Add Class..., then rename the file from Class1.cs to Animal.cs).
- Edit your Animal class to make it look like what you see on page 23.
- In your Main function of your Program.cs file, try to use your class as you see on page 24.
- Build and correct errors. Feel free to experiment.
Thursday, June 26, 2008
Object-Oriented Programming and Data Types
Reading
Read the C# For Sharp Kids starting from the section entitled "The Object-Oriented Approach Summarized". Continue reading to where the binder clip is. Some of this is re-reading from yesterday. Pay attention to the notes I made in the document.
The new reading section talks about data types and fields. This should be like a review, however they do a good job of explaining it here.
Code Study
Look at Program2. It is in "D:\John's Documents\MSDN\Csharp for Sharps Kids\Examples - CSharp\Program2". The program is very similar to what you have been writing. I placed comments in the code directed at you.
Read the C# For Sharp Kids starting from the section entitled "The Object-Oriented Approach Summarized". Continue reading to where the binder clip is. Some of this is re-reading from yesterday. Pay attention to the notes I made in the document.
The new reading section talks about data types and fields. This should be like a review, however they do a good job of explaining it here.
Code Study
Look at Program2. It is in "D:\John's Documents\MSDN\Csharp for Sharps Kids\Examples - CSharp\Program2". The program is very similar to what you have been writing. I placed comments in the code directed at you.
Subscribe to:
Posts (Atom)
