Inheritance - Teradata Meta Data Services

Teradata Meta Data Services Programmer Guide

Product
Teradata Meta Data Services
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
Product Category
Teradata Tools and Utilities

Inheritance

Inheritance is a feature that allows creation of a class that inherits the properties and relationships from a previously defined class. A class that inherits from another class is called a subclass. The class that the subclass “inherits from” is called the superclass.

A subclass will contain all the properties of the class(es) it inherits from. In Figure 3:

  • Class A has properties A and B.
  • Class G inherits from Class A.
  • Class G also has the properties A and B and any properties specifically created for Class G, for example, properties C and D.
  • Class M is created from Class G and inherits all the properties of Class G, and also includes the properties of Class A.
  • A class can only inherit directly from one class, but the class it inherits from can have up to four superclasses. So a class can have up to five superclasses: the class it directly inherits and the superclasses of that class.

    Figure 3: Class Inheritance of Properties

    A class also inherits all the relationships of its superclasses.

    Figure 4 shows a relationship called RelAM that has the origin class of ClassA and the destination class of ClassM. All classes that inherit from ClassA and ClassM also inherit this relationship. This means that ClassB and ClassC objects can be origin objects in this relationship and ClassN and ClassO objects can be destination objects. As shown in Figure 4, you can add a ClassM, ClassN or ClassO object to the destination collection of a ClassA, ClassB or ClassC object.

    Figure 4: Class Inheritance of Relationships