15.4. Exercises

  1. A golf club wants to set up a membership program capable of sending out mail, e-mails, and voting ballots to its members. The membership consists of junior, regular, and senior golfing members, plus a social membership, which excludes golf. The problem is that junior and social members are not allowed to vote on club issues. Also, social members should not receive mailings about golf tournaments since they are not allowed to use the course, only the pool and restaurant facilities. If you were to write the program, how would you organize it?

  2. Suppose you see the following line of code in a program:

    public clsJunion(string addr, int status, decimal minimum)
                   : base(string addr, int status, decimal minimum)

    What can you tell me about the line of code?

  3. Some programmers don't like the protected access specifier. What do you think might be their reasons?

  4. How would you prevent other programmers from extending one of your classes via inheritance?

  5. Does inheritance bring anything to the party that we couldn't do without it?

Get Beginning C# 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.