Share via


How to: Define Inheritance Between Types (Class Designer)

Using Class Designer, you can define an inheritance relationship between two types by connecting the base class to the derived class or classes. If the parent class is an abstract class and if it contains at least one abstract member, then all abstract members will be implemented as non-abstract inheriting classes. For more information, see How to: Implement an Abstract Class (Class Designer).

Note

By using Class Designer, you can visualize existing generic types, but you cannot create new generic types. Also, you cannot modify type parameters for existing generic types.

To define inheritance between two types

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

    Tip

    If your project does not contain a class diagram file, you must first add one. For more information, see How to: Add Class Diagrams to Projects (Class Designer).

  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 that represents the derived type to the shape that represents 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.

  5. Optionally, when deriving from a generic class, select the inheritance line and set the Type Arguments property (in the Properties window) to match the desired type for the generic type.

See Also

Tasks

How to: View Inheritance Between Types (Class Designer)

Concepts

Visual C++ Classes in Class Designer

Other Resources

Working with Class Diagrams (Class Designer)

Designing Classes and Types (Class Designer)