company logo

Virtual member

Keywords:  virtual feature

Virtual members are members that can be overloaded in specialized structure definitions. This feature is typically used for function definitions in C++. It is, however, also possible to overload the member definition for structure members (references and relationships) in specialized structures. When overloading structure members, it is not possible to change the member type, i.e. references can be overloaded with reference members and relationships with relationship members, only.

Defining a base structure as virtual will create only one base instance in case of multiple inheritances (C++ feature) and is not supported for persistent structures.

Considering structure definitions for Train and PersonTrain (special train) as

Structure   Train

    relationship      wagon (Wagon) virtual

Structure  PersonTrain

   base_structure  train (Train)

   relationship      wagon (PersonWagon)

the wagon definition in PersonTrain is overwritten with a more special wagon type.