Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

What is the equivalent to SUPER ?

Former Member
0 Kudos

Hello,

assume a class A and a class B, where A is the super-class for B.

I.e. within B I can address/access attributes of A by using "pseudoreference" super.

Now I´d like to address/access an attribute from B within A. Does there exist an equivaltent to super? I.e. is there a pseudoreference "sub" or something like this? (Of course it would be necessary to use TRY, ENDTRY to assure that access to a non-existing attribute does not cause an error).

Does anybody know what to do in this case?

Thank you for your help,

Stefan

4 REPLIES 4

0 Kudos

Hi,

Inheritance is ONE WAY, a SUB class can see its SUPER where as a SUPER class can never see its SUB. SUPER class doesnt even know what all classes are inheriting from it. So there is nothing like SUB.

It is not correct to provide such thing. A supper class should never bother about its subclasses.

Regards,

Sesh

Message was edited by:

Seshatalpasai Madala

0 Kudos

Hello,

yes, this seems to be correct.

However, when using pseudoreference ME in a SUPER-class this is the reference to the SUB-class; so that in a runtime environment the super-class knows it´s sub-class! My problem is that I can see it via ME, but I´m not able to access the attributes of the SUB-class (that this is not possible statically is clear, but I thought there is a way to do this dynamically?).

Regards,

Stefan

0 Kudos

Hello,

FRIEND-concept seems not to work (or I´m to silly for it). However, finally I found a way to access attributes and methods of the sub class using ME reference and ASSIGN ... CASTING the sub-class attribute or method.

Regards,

Stefan

Former Member
0 Kudos

Hi,

A-Super Class, B-Sub Class

There is no way to access B's "PRIVATE" attribute from A. Public attributes can be access.

You can use FRIEND concept, make A as a friend of B, then A can access B's attributes.

Hope this is useful to you,

Thanks,

Chetan Shah