This example shows the Class myClass that has Operation myClass(), which is the constructor, and Operation ~myClass(), which is the destructor. 

Example Constructor and Destructor in the Class diagram

The Constructor and the Destructor operations. 

To create a Constructor



  1. Create a Class with an Operation.
  2. Go to the Class Specification window.
  3. Select Operation
  4. Apply the stereotype «C++Constructor» for Operation.


To create a Destructor



  1. Create a Class with an Operation.
  2. Go to the Class Specification window.
  3. Select Operation
  4. Apply the stereotype «C++Destructor» for Operation.