the Main properties of inheritance
Association of inheritance, such
наследованием class in the Association —
предок and the external
Basic properties of inheritance
- When you inherit the attribute structure and composition of links is always increasing and can not be reduced (each inherited table stores
- The heir is available in the all attributes and associations of the ancestor. So, if we take an inner class
InternalChild, its attributes will be
Detail1, Detail2, Detail3, Detail4.
- Ancestor provides polymorphic access to all his heirs, which means that the instance of the inner class and its heirs (in this case
Internal and InternalChild) can be set as an instance of the artisan class (in this case
Master2) and an instance of any heir of the master (in this case
Master2Child). The situation is similar with detaylari: instance
Detail2operates with instances and
Detail2 Detail2Child, and similarly for attributes and methods of the class. In practice, this phenomenon can cause the problem to be solved with the help of a typeusage](fo_type-usage-problem.html) that in a particular way is displayed in the data structure.
- If the heir has the attribute method (with the same composition parameters), the Association (with the same role name), it means that the heir
перегружаетthis element ancestor.
- Heir from the master can be detailon the same inner class (as in a situation
Internal-Master1-Detail4), that’s fine.
Note: a Frequently asked question as to why the table of the heirs keep all attributes of all ancestors, not just their own. A: then when reading the object-the heir you need to collect all the attributes from the tables of their ancestors along the chain through
JOINwhich is very slow, especially when reading different types of objects in a single query. Therefore, application performance will decrease with increasing number of levels of inheritance, which is unacceptable.
Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru