Objects of implicit type

Objects of implicit type are simple objects that cannot be reused for defining other objects. Implicit types facilitate instance‑based modeling, which is different from pure object-oriented modeling. Object-oriented modeling requires every structural entity to be an instance of an existing type. This required structure is known as the type/instance dichotomy in object-oriented systems.

For objects of implicit type, a C structure is generated with the name of the object and the suffix "_t." A type is not defined for the object. For example, a C structure named A_t is generated in the specification file for an object A that is of implicit type. This object has one attribute named att1, which is generated as a data member of the structure, as follows:

struct A_t {
    /***    User-explicit entries    ***/
    int att1;      /*## attribute att1 */
};

The object is instantiated and memory is allocated in the specification file for the package to which the object belongs. For example, the following statements are generated in the specification file for the Default package, to which the object A belongs:

struct A_t;
extern struct A_t A;

The first statement is a declaration of the structure A_t; the second is the actual definition and memory allocation for an instance A of struct A_t.

Note: The extern keyword indicates that A is declared here but defined (once) elsewhere. Any code following such a declaration can refer to A. If the same extern statement appears in different files, these statements refer to the same A.

IBM® Rational® Rhapsody® automatically generates operations to handle object creation, initialization, cleanup, and destruction. These operations are analogous to what are known as constructors and destructors in C++. For example, the following operations are automatically generated for A:

Create() and Destroy() operations are not generated for singletons. See Singleton objects for more information.


Feedback