Click to See Complete Forum and Search --> : Implement....


udipr
May 10th, 2001, 01:54 AM
Hello.

I have two classes:
ClassA (Include 2 method: M1, M2)
ClassB (Include Implement of ClassA + New Method M3)

In my program I define the class (as written in MSDN) like this:

Dim ObjA as ClassA
Dim ObjB as new ClassB

set ObjA = ObjB




The problem is that ObjA don't recognize the method M3 !!!
What can I do ???

Thanks for any help.

coolbiz
May 10th, 2001, 08:47 AM
I think this is because ObjA is ClassA type and not ClassB type. Therefore, it only knows M1 and M2 eventhough in the memory M3 does exist. At least this is how it works in C++.

-Cool Bizs

Cakkie
May 10th, 2001, 08:50 AM
If you say implement, are you using the implements keyword? If so, youre actually using an interface. In this case, class A may not include any code, just de declaration of the methods. You will have to write your own implementation of M1 and M2 in class b, but they can be refferenced by an object of class A, but only the methods described in class a.

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook