Share via


Adding a Generic Class

OverviewHow Do I

A generic class is a class that you define or that is derived from a class that you define. To add a generic class, you can use ClassView, WizardBar, or the New Class command (Insert menu).

To add a generic class to your project

  1. Open the New Class dialog as described in the New Class dialog box.

  2. From the Class type drop-down list, select Generic Class.

  3. In the Name box, specify the name of the new class.

    The name you specify is reflected in the read-only File name box, where the .cpp file is specified. By default, the header file and the implementation file have the same name as the class file.

    • To change the names of the header and implementation files for this class, choose the Change button and type the names into the Change Files dialog.

    • To add the new class to existing files, click Change, then click the Browse button and locate the files you wish to add it to.

  4. Under Base Classes, in the Derived From column, type the name of the base class from which to derive the new class. In the As column, click the access the new generic class is to have with regard to the base class: public, protected, or private.

See Also   Adding an MFC Class, Adding an ATL Class