Base or derived class?

parul

Member
Bear with me while I explain this:

I have a class a.cls

b.cls inherits a.cls and has a method getMessage().

Now if I say

def var dCls as class a.

dCls = new b().

it works fine, which is good.

now if say
dCls:getMessage().

The compiler complains that getMessage was not found.
But I instantiated derived class not the base class.
dCls should be an instance of derived class.

or am I getting it all wrong??

-Parul.
 

Casper

ProgressTalk.com Moderator
Staff member
Try:

Code:
assign dCls = new b().
MESSAGE cast(dCls,b):getMessage()
    VIEW-AS ALERT-BOX INFO BUTTONS OK.

Since you defined dCls as a, you still have to cast it to b, so that the variable defined as class a, actually behaves like b.

Casper.
 
Top