Skip to main content

Inheritance

A data type is a class, just as Film is a class. Whenever we define a class, we have a choice: we can create it from scratch, as we did with Film, or we can base the new class on one that already exists. This process is called inheritance, because the new class inherits some characteristics of its parent.

generated description: newinheritance.jpg

All classes in Caché—whether they are data types, persistent classes, or some other type—inherit from system classes provided by Caché. Normally, these inherited classes aren't shown in the Studio, because there are many of them and it's easier for the developer to focus on the ones he or she programmed. You request to see them if you want to, though.

In our example, the child class (or subclass) Duration inherits from the parent class (or super class) Integer which is provided by Caché. Duration will be exactly the same as %IntegerOpens in a new tab in all respects except for the LogicalToDisplay method.

FeedbackOpens in a new tab