User objects that behave like structures – PB Docs 2017

User
objects that behave like structures

In PowerBuilder, a nonvisual user object can provide functionality
similar to that of a structure. Its instance variables form a collection
similar to the variables for the structure. In scripts, you use dot
notation to refer to the user object’s instance variables, just as you
do for structure variables.

Advantages of user objects

The user object can include functions and its own structure
definitions, and it allows you to inherit from an ancestor class. None
of this is possible with a structure definition.

Memory allocation
differences

Memory allocation is different for user objects and structures. An
object variable is a reference to the object. Declaring the variable
does not allocate memory for the object. After you declare it, you must
instantiate it with a CREATE statement. Assignment for a user object is
also different (described in Assignment for objects and
structures
).

Autoinstantiated objects

If you want a user object that has methods and inheritance but
want the memory allocation of a structure, you can define an
autoinstantiated object.

You do not have to create and destroy autoinstantiated objects.
Like structures, they are created when they are declared and destroyed
when they go out of scope. However, because assignment for
autoinstantiated objects behaves like structures, the copies made of the
object can be a drawback.

To make a custom class user object autoinstantiated, select the
Autoinstantiate check box on the user object’s property sheet.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x