Inheritance
Inheritance is the mechanism by which a newly created object shares the structure of one or more existing objects. Oracle Forms incorporates inheritance by means of property classes and subclassing.
Consider the standard toolbar application discussed in Chapter 1, "GUI Development." Here we used a property class, named PC_ICONICBUTTON, which was applied to each of the iconic buttons. An example of such a property class appears in Figure 6.1, and an example of applying this property class to individual buttons is shown in Figure 6.2.
Figure 6.1. A property class for iconic buttons.
Figure 6.2. An example of applying a property class to an item.
This eliminates the need for specifying the common properties individually for each icon.
Inheritance by means of property classes is limited to
- Creating the property class and attaching it to a Forms object. The target object is automatically subclassed.
- Adding it to an object library. Then a Forms object can subclass it from the object library by a simple drag and drop or as a smart class.
- Directly subclassing or copying the property class across another Form module.
Here are some points to keep in mind about inheritance using property classes:
- An object based on a property class automatically inherits its properties.
- Properties that inherit their values from the property class are displayed with an = symbol in front of the property name .
- The inherited properties can be overridden if necessary.
- Triggers can be a part of a property class. For an object that has a trigger defined at its level and also in the property class that it inherits, the property class trigger is ignored.
- A property class can be attached to existing property classes. This enables inheritance from parents of parents of parents, thus providing additional reusability.
- Property classes can be copied between form modules.
- Properties to derived objects cannot be added through property classes.
Inheritance by means of subclassing is discussed in the Object and Code Reusability section.