Creating an operation redefinition

Redefining a standard operator

In C++, you can redefine standard operators, and for this, Modelio C++ Designer lets you declare this construct. Coplien form defined on a newly created class contains such an example.

<<Cxx.Operator>> operator =(in value : OperatorRedefinition):OperationRedefinition

To redefine a standard equality operator, the following steps should be carried out:

Creating a cast operator

C++ also authorizes the creation of cast operators, to allow implicit conversion between types.

To define a cast operator, carry out the following steps:

The generated code will be as follows:

operator bool();