October 2008
Beginner to intermediate
680 pages
16h 48m
English
Given a class Book defined as having the following fields:
Author author; string title; int noOfPages; bool fiction;
Write a set of properties for these fields with simple, one-line get and set accessors.
What would the recommended headers be if we were to write "get" and "set" methods for all of these fields?
It's often possible to discern something about a class's design based on the method calls on objects in client code. Consider the following client code "snippet:"
Student s;
Professor p;
bool b;
string x = "Math";
s.Major = x;
if (!s.HasAdvisor())
b = s.DesignateAdvisor(p);
What members—fields, methods, properties—are implied for the Student and Professor classes by virtue of how this client code is structured? Be as specific ...
Read now
Unlock full access