Compartir a través de


How to: Create Inheritance Between Types (Class Designer)

To create an inheritance relationship between two types on a class diagram using Class Designer, connect the base type with its derived type or types. You can have an inheritance relationship between two classes, between a class and an interface, or between two interfaces.

To create an inheritance between types

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

    If you don't have a class diagram, create it. See How to: Add Class Diagrams to Projects (Class Designer).

  2. In the Toolbox, under Class Designer, click Inheritance.

  3. On the class diagram, draw an inheritance line between the types that you want, starting from:

    • A derived class to the base class

    • An implementing class to the implemented interface

    • An extending interface to the extended interface

  4. Optionally, when you have a derived type from a generic type, click the inheritance line. In the Properties window, set the Type Arguments property to match the type that you want for the generic type.

    Note

    If a parent abstract class contains at least one abstract member, then all abstract members are implemented as non-abstract inheriting classes. See Implementing Abstract Base Classes.

    Although you can visualize existing generic types, you can't create new generic types. You also can't change the type parameters for existing generic types.

See Also

Tasks

How to: View Inheritance Between Types (Class Designer)

Reference

Inheritance (C# Programming Guide)

Concepts

Inheritance Basics (Visual Basic)

Visual C++ Classes in Class Designer