Developing Yed objects - Inheritance mechanism

Yed scenario allows inheritance from release 2.0.0. These are the characteristics of inheritance mechanism implemented:

When an object A inherits interface and implementation from an object B , A contains all B entities plus its own entities; in Yed scenario, this is realized declaring into a Yed derived object all entities of the Yed object it derives from, together with the specific entities of the new object. This implies that physical position of entities into the object declaration is very important: to assure that all methods properly access their own state avoiding casting problems of 'this' pointer, it needs that every entity be declared at the same memory offset, from the beginning of object declaration, in all objects in which it appears, starting from and included the Yed base object from which it start to propagate itself.
In other words, if methods, private attributes and public attributes of a generic Yed object are properly declared and defined in a Yed derived object, and if all declarations of these entities are in the same memory offset in both objects instances, then it's possible to invoke methods defined in a Yed base object also through an instance of a Yed derived object, because the casting of pointer 'this' does not alter the access to the state of the instance.
To do so, these are the rules to follow in declaring Yed object and its methods:

Last rule seems to be opposed to concept expressed in 'Developing Yed objects - Hiding functions' paragraph, but it's necessary to propagate method implementation towards Yed derived object; so because this attribute makes impossible, from the linker, to locate the implementation code if it is defined in another file: then you must delete it, so the inheritance can be properly done.
Naturally, an object without other objects inheriting from it can continue to hide method implementation through this attribute.

Next paragraphs show various example of inheritance in Yed scenario.


http://yed.sourceforge.net