Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Resolving naming conflicts – PB Docs 2019 – PowerBuilder Library

Resolving naming conflicts – PB Docs 2019

Resolving naming conflicts

There are two areas in which name conflicts occur:

  • Variables that are defined within different scopes can have the
    same name. For example, a global variable can have the same name as a
    local or instance variable. The compiler warns you of these conflicts,
    but you do not have to change the names.

  • A descendant object has functions and events that are inherited
    from the ancestor and have the same names.

If you need to refer to a hidden variable or an ancestor’s event or
function, you can use dot notation qualifiers or the scope
operator.

Hidden instance variables

If an instance variable has the same name as a local, shared, or
global variable, qualify the instance variable with its object’s
name:

If a local variable and an instance variable of a window are both
named birthdate, then qualify the instance variable:

If a window script defines a local variable x, the name conflicts
with the X property of the window. Use a qualifier for the X property.
This statement compares the two:

Hidden global variables

If a global variable has the same name as a local or shared
variable, you can access the global variable with the scope operator (::)
as follows:

This expression compares a local variable with a global variable,
both named total:

Use prefixes to avoid naming conflicts

If your naming conventions include prefixes that identify the
scope of the variable, then variables of different scopes always have
different names and there are no conflicts.

For more information about the search order that determines how name
conflicts are resolved, see the section called “Declarations” in PowerScript Reference and the section called “Calling Functions and Events” in PowerScript Reference.

Overridden functions and
events

When you change the script for a function that is inherited, you
override the ancestor version of the function. For events, you can choose
to override or extend the ancestor event script in the painter.

You can use the scope operator to call the ancestor version of an
overridden function or event. The ancestor class name, not a variable,
precedes the colons:

You can use the Super pronoun instead of naming an ancestor class.
Super refers to the object’s immediate ancestor:

In good object-oriented design, you would not call ancestor scripts
for other objects. It is best to restrict this type of call to the current
object’s immediate ancestor using Super.

For how to capture the return value of an ancestor script, see Return values from ancestor
scripts
.

Overloaded functions

When you have several functions of the same name for the same
object, the function name is considered to be overloaded. PowerBuilder
determines which version of the function to call by comparing the
signatures of the function definitions with the signature of the function
call. The signature includes the function name, argument list, and return
value.

Overloading

Events and global functions cannot be overloaded.


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