Creating a Class Using a Metaclass

Once you have added one or more metaclasses to your project, either by creating them directly, or by including a project that already has metaclasses, you can select the metaclass you want to use to create a class. When you create a class using a non-standard metaclass, the class is given the attributes specified by the selected metaclass. Unless you make changes, every new subclass you create for class will also use the selected metaclass.

This example uses the newspaper_extended project, which includes the diagram project and tables project, both of which supply metaclass structure. You can also use these structures in your own projects by including the corresponding project. However, you must structure your project in a specific way in order to be able to use these features. See the tutorial for more information.  

If you create a class using the Create button, you will use the metaclass of the direct superclass as the metaclass for the new class. Unless you have made changes, this is the default :STANDARD-CLASS.

To create a class using a non-standard metaclass:

  1. In the Class Relationship Pane, find the class that you want as the superclass of the new class. 
  2. Click the right mouse button and select "Create subclass using metaclass..." 
  3. A dialog box displays the Concrete metaclasses, which are the classes you can use when creating a class. You cannot create a class as an instance of an Abstract metaclass.
  4. Select the metaclass that has the properties that you want and click OK. 
    The new class will be added under the highlighted class. It will have the Class Form determined by the selected metaclass. The name of the metaclass you used is displayed at the top of the Class Form, immediately after the name of the class. The Class Form may include additional widgets that are not part of :STANDARD-CLASS.
  5. Use the Class Form to name the class, choose its role, create constraints, and create and edit slots. 

Next: Changing the Metaclass of a Class

Classes Table of Contents