PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

maybe it's just too late (class derivation)

Moose or Chuck · 08 Nov 2001, 02:13 UTC
Howdy,

Maybe it's too late (2am) but I am having issues thinking this one out.  I have a class that is derived from a base class.  This class adds a special function that is not found in the base class.  I am having issues calling this special function from my container class which holds anything of the base class or the derived class. How can I tell it to use the method from the derived class?  

I think that question is totally unclear.  good luck deciphering my brain fart.

- Ketamine
Okay, you lost me with the "container" class. You need to construct a class of the derived type, not the base type. Say you have a class CBase, and CDerived. You can't create a CBase and access members in CDerived. You need to create a CDerived. That may not answer your question because I don't understand where the containter class fits in.

Dan East

Try this one ---
Now in container class u might have declared
an object of base class to access the derived class but base classs does not have direct link
to its derived class---instead of that declare
the object  of derived class...
hope this helps

Regards