10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

InheritanceTo build meaningful objects representing your organization's data, you mustunderstand basic concepts concerning classes and specific information aboutuser classes. The following sections lay the groundwork for you to buildobject-oriented applications.InheritanceOpenROAD classes are organized into an inheritance hierarchy. Withinheritance hierarchy, a class that is a child of another class is considered itssubclass and a class that is the parent of another class is considered itssuperclass. Each subclass inherits the attributes and methods for all itssuperclasses.The higher a class's position in the hierarchy, the more generalized are thecharacteristics and functions that it defines. Classes lower in the hierarchydescribe objects with specialized characteristics that function in a specificmanner. For example, the characteristics and functions defined for theFieldObject system class apply to all fields and menu items, whereas theButtonField system class defines a very specific object.The inheritance hierarchy is useful in avoiding redundant definition of functionsand characteristics. Attributes and methods are defined at the most generallevel possible and inherited by all subclasses.For example, the ButtonField system class is a subclass of ScalarField. Thecomplete list of attributes and methods available for ButtonField includes theattributes defined for ScalarField and its superclasses (ActiveField, FormField,FieldObject, and Object) as well as those defined specifically for ButtonField.Because both ButtonField objects and SliderField objects have backgroundcolor, both of these system classes inherit their background color (BgColor)attribute from the same superclass, FieldObject. The BgColor attributefunctions identically for both field objects, for example:field(my_button_field).BgColor = CC_YELLOW;field(my_slider).BgColor = CC_YELLOW;Some classes are created for the sole purpose of high-level attribute andmethod definition. General classes that are used for classification only areknown as abstract classes in object-oriented programming. Examples ofabstract system classes in OpenROAD include ActiveField and FieldObject.Working with Classes 121

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!