Defining Relationships Between Classes

One of the biggest benefits of the class diagram is that it visually represents the relationships between classes. These relationships are much easier to see in a diagram than through code. The following relationships can be represented:

InheritanceIndicates whether a class inherits from another class

InterfaceIndicates whether a class implements one or more interfaces

AssociationIndicates an association between classes

Let’s look at implementing each of these relationships through an example.

Inheritance

First, let’s look at inheritance with the class designer. Suppose that you have a base class called EmployeeBase. This class represents a generic employee in your system. You then want to create ...

Get Microsoft® Visual Studio® 2010 Unleashed 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.