Inheriting from an external class
Use the CG::Class::UseAsExternal
property
to inherit from a class that is not part of the model.
About this task
To inherit from a class that is external to the model:
- Set the
CG::Class::UseAsExternal
property for the class toChecked
. Use this setting to prevent code from being generated for the superclass. - To generate an
#include
of the class header file in the subclass, do one of the following:
- Add the external element to the scope of some component.
- Map the external element to a file in the component.
- Set the
CG::Class::FileName
property for the class to the name of its specification file (for example,super.h
). That file is included in the source files for classes that have relations to it. If theFileName
property is not set, no#include
is generated.
If you need a class to import an entire
package instead of a specific class, add a dependency (see Dependencies) with a stereotype of «Usage»
to
the external package.