How to: Define Inheritance Between Types

In Class Designer, you can define an inheritance relationship between two types on a class diagram.

To define inheritance between two types

  1. From the project in Solution Explorer, open the class diagram (.cd) file.

  2. In the Class Designer toolbox, click the Inheritance tool.

  3. Move the pointer to the class diagram.

    The pointer changes into an inheritance cursor.

  4. On the class diagram, drag a line from the shape representing the derived type to the shape representing the base type.

    Tip

    The inheritance cursor changes to a connected cursor when you can create an inheritance relationship. The inheritance cursor changes to a no-drop cursor when you cannot create an inheritance relationship.

    An inheritance line with an arrow pointing from the derived type to the base type appears between the two shapes on the diagram. The type shape of the derived type also displays the name of the base type.

    Note that if the parent class is an abstract class and contains at least one abstract member, those members will automatically be implemented in non-abstract inheriting classes. For more information, see How to: Implement an Abstract Class.

See Also

Tasks

How to: View Inheritance Between Types

Concepts

Visual C++ Classes in Class Designer

Other Resources

Working with Class Diagrams

Designing Classes and Types