Implementing Derived Classes
The Class Designer is powerful enough to provide support for class inheritance. Suppose you want to create two classes deriving from Person
, for example Contact
and Customer
. To create a Contact
class that inherits from Person
, follow these steps:
1. Right-click the designer surface and select the Add, Class command. When the New Class dialog appears, specify the class name and leave the other properties unchanged.
2. When the new class is added to the designer’s surface, double-click it and in the code editor add an Inherits Person
statement below the class declaration, then switch back to the class diagram. This establishes an inheritance relationship between the two classes. You notice that the designer does not ...
Get Visual Basic® 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.