Skip to main content

Inheritance (Class Keyword)

Specifies the inheritance order for the superclasses of this class.

Usage

To specify the inheritance order for the superclasses of this class, use the following syntax:

Class MyApp.MyClass Extends (MySuperClass1, MySuperClass2) [ Inheritance = inheritancedirection ] { //class members }

Where inheritancedirection is left or right.

Or omit this keyword. In this case, InterSystems IRIS uses the default inheritance direction (left).

Details

The Inheritance keyword specifies inheritance order for a class with multiple inheritance. A value of left for inheritancedirection specifies left-to-right inheritance and a value of right specifies right-to-left inheritance.

For example, in the class definition in the synopsis, a value of left specifies that conflicting member definitions between MySuperClass1 and MySuperClass2 are resolved in favor of MySuperClass1; by contrast, a value of right specifies that conflicting member definitions between MySuperClass1 and MySuperClass2 are resolved in favor of MySuperClass2.

Important:

The leftmost listed superclass is always the primary superclass, regardless of inheritance order.

Effect on Subclasses

This keyword is not inherited.

Default

If you omit this keyword, the inheritance order is left.

See Also

FeedbackOpens in a new tab