Compartir a través de


Inheritance Terminology

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

This topic describes the terminology that is used to discuss the inheritance relationships between sets of classes or set of tables in Microsoft Dynamics AX.

Inheritance Terminology

In X++, suppose that class AA extends from the Object class, and class BB extends AA, and class CC extends BB. This inheritance hierarchy can be represented by the following notation:

Object > AA > BB > CC

Gg845237.collapse_all(en-us,AX.60).gifTable of Terms

The following table describes the terms that are used to discuss the inheritance example in the previous notation.

Term

Use

ascendant

Class AA is an ascendant of CC.

base

Class AA is the base of BB.

child

Do not use child when discussing inheritance.

This term is often used when discussing foreign key relationships between tables.

descendant

Class CC is a descendant of AA.

derived

Class BB is derived from AA.

downcast

The X++ assignment statement myCC = myAA as CC; is a downcast assignment. The as keyword is needed at compile time for downcasting. The downcast might or might not be valid at run time. For more information, see Expression Operators: Is and As for Inheritance.

The Object class is said to be at the top of the inheritance hierarchy. The CC class is at the bottom of the hierarchy. Casting from class AA to CC goes down the hierarchy.

The following code example illustrates an invalid downcast.

B myBB = new BB();
CC myCC;
myCC = myBB as CC;

extends

In X++, the extends keyword is used in the classDeclaration node of a class in the Application Object Tree (AOT). The extends keyword means that the present class derives from the class that is named on the extends clause.

Extends

At AOT > Data Dictionary > Tables > MyTable > Properties, the Extends property is used to derive MyTable from another table.

inherits

Class BB inherits from the AA class and the Object class.

parent

Do not use parent when discussing inheritance.

This term is often used when discussing foreign key relationships between tables.

subtype

Class BB and class CC are both subtypes of class AA.

supertype

Class BB and class AA are both supertypes of class CC.

upcast

The X++ assignment statement myAA = myCC; is an upcast assignment. Upcasting is valid at compile time, and is valid during run time. The as keyword is not needed.

The Object class is said to be at the top of the inheritance hierarchy. The CC class is at the bottom of the hierarchy. Casting from class CC to AA goes up the hierarchy.

The following code example is an upcast.

BB myBB = new BB();
AA myAA;
myAA = myBB;

See also

Table Inheritance Overview

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.