K Desktop Environment

10.3. Managing Classes

The Class Browser additionally allows adding methods and attributes directly by dialogs. This means you don't have to type the classdeclaration and the implementation header yourself. After adding a method, you only have to set the formal parameters to the implementation header and, if the method requires an attribute, to the declaration .

How to add a method to a class

  1. select the class you want to add a method

  2. press the right mouse button; the popup menu appears

  3. select "Add member function".

  4. the "Add member function" dialog appears.

  5. insert the type, declaration and documentation for the method

  6. specify the access and the modifiers for the method

  7. press OK to exit the dialog

For adding a variable , this is the same action, just with selecting "Add member variable " in the popup menu.

The difference between the actions of these dialogs is that the adding of a variable will add the variable to the classdeclaration , the adding of a method will add the method's declaration and the method's implementation header to the sources. As the classviewer directly updates himself, you have a direct access to the new method implementation , so you only have to fill out the code for the actual purpose of the method.