May 2008
Beginner
550 pages
13h 22m
English
Suppose you are adding the following data items as properties to a class. How would you write them in the class?
A person's last name
A zip code
The days of the week
Suppose you want to add a general method to the clsDates class that returns the number of days in a given month. How would you write the code?
Give a good example of where you would use the public access specifier to define a class property.
Modify the following SOC code to use an if statement instead:
lblLeapYearResult.Text = year.ToString() + " is " +
((leap == 1)? "":"not ") + "a leap year";
Which form would you use in your own code and why?
Suppose you overload the clsDates constructor so that the following constructor is available. Would you modify your getLeapYear() method and, if so, how?
public clsDates(int yr)
{
year = yr;
}
Read now
Unlock full access