October 2008
Beginner to intermediate
680 pages
16h 48m
English
When we first discussed the fields and methods associated with the Student class, we stated that some of the fields could be represented by predefined types provided by the C# language, whereas the types of a few others (advisor, courseLoad, and transcript) were left undefined. Let's now put what we learned about user-defined types to good use.
Instead of declaring the Student class's advisor field as simply a string representing the advisor's name, we'll declare it to be a user-defined type—namely, type Professor, another class that we invented (see Table 3-2).
| Field | Type |
|---|---|
| name | string |
| studentId | string |
| birthdate | DateTime |
| address | string |
| major | string |
| gpa | double |
| advisor | Professor |
| courseLoad | ??? |
| transcript ... |
Read now
Unlock full access