Discussion:
Q: Create a class diagram (in Visual Studio 2008 C#) based on the following scenario: When constructing classes that will represent objects in a system, it is important to ensure the integrity of those objects and be able to define the types of relationships they will form with other objects.
Define three classes: a student class, a subject class, and a course class. The student class will contain the necessary properties, such as studentID, that will be properly encapsulated with public getters/setters (accessors/mutators) while keeping the internal variables private. Use the same encapsulation techniques on the course and subject classes. The subject class will define an Object-Oriented Programming course, and will inherit from the course class that will contain the behaviors and properties common to all subjects.
After correctly constructing or encapsulating these three classes, create an inheritance relationship between the subject and the course. A course has a student, so define a composition method for a course that allows it to add students.
Completed class diagram should show each object's encapsulated methods, the inheritance between subject and course, and the composition of students in courses.