Using the inherited information

When you build and save a user object, PowerBuilder treats the object as a unit that includes:

  • The object (and any controls within the object if it is a custom visual user object)

  • The object's properties, events, and scripts

  • Any variables, functions, or structures declared for the object

When you use inheritance to build a new user object, everything in the ancestor user object is inherited in the direct descendant and in its descendants in turn.

Ancestor's instance variables display

If you create a user object by inheriting it from a custom class or standard class user object that has public or protected instance variables with simple datatypes, the instance variables display and can be modified in the descendant user object's Properties view.

All public instance variables with simple datatypes such as integer, boolean, character, date, string, and so on display in the descendant. Instance variables with the any or blob datatype or instance variables that are objects or arrays do not display.

What you can do in the descendant

You can do the following in a descendant user object:

  • Change the values of the properties and the variables

  • Build scripts for events that do not have scripts in the ancestor

  • Extend or override the inherited scripts

  • Add controls (in custom visual user objects)

  • Reference the ancestor's functions and events

  • Reference the ancestor's structures if the ancestor contains a public or protected instance variable of the structure datatype

  • Access ancestor properties, such as instance variables, if the scope of the property is public or protected

  • Declare variables, events, functions, and structures for the descendant

What you cannot do in the descendant

In a descendant user object, you cannot delete controls inherited from a custom visual user object. If you do not need a control in a descendant user object, you can make it invisible.

Understanding inheritance

The issues concerning inheritance with user objects are the same as the issues concerning inheritance with windows and menus. See Understanding Inheritance for more information.