Share via


Deleting a Member Function

OverviewHow Do I

You can delete a member function by using ClassWizard, ClassView, or WizardBar. Deleting a function with ClassView or WizardBar removes the function declaration from the header (.h) file, removes any associated map entry from the MSG, MESSAGE or DISPATCH map, and comments out the function definition, if one exists. The function body remains selected so that you can easily delete it permanently if you wish.

If you delete a member function in the ClassWizard dialog box, the declaration is deleted from the class in the header file, and (if it is a message handler) any message-map entry is deleted from the implementation file. However, you must also manually remove the function definition, as well as any references to the function, from the implementation file. Browse through the class structure with ClassWizard to help you locate these references.

To delete a member function with ClassView

  1. In the ClassView pane, open the class that contains the function and select the function.

  2. Click the right mouse button, and choose Delete.

    A dialog box will prompt you to confirm that you want to delete the function.

  3. Click Yes to delete the specified function.

To delete a member function with WizardBar

  1. First ensure that the function is in a class that is part of .

  2. Navigate to the function in the text editor, for example by using ClassView, or selecting it from the WizardBar Members combo list.

  3. With the function name displayed in the Members combo, open the WizardBar Action menu and click Delete.

    The Action menu appears when you choose the arrow next to the Action button, or when you click the right mouse button when focus is on a WizardBar combo control.

    A dialog box will prompt you to confirm that you want to delete the function.

  4. Click Yes to delete the specified function.

To delete a member function with ClassWizard

  1. In the ClassWizard dialog box, click the Message Maps tab.

  2. In the Class name box, select the class containing the member function you want to delete.

  3. In the Member functions box, select the name of the member function to delete.

  4. Click Delete Function. This deletes the function entries from the message map for that class in both the header and implementation files.

  5. You will be reminded to edit the implementation file containing the member function. Using a text editor, comment out or delete the function header and function body.

See Also   Adding a Class, Adding a Member Function, Adding a Member Variable, Overriding a Virtual Function, Adding a Message Handler, Navigating the Class Structure