-
Code:
// works
pform[i]->askName();
pform[i]->setName(gchar);
...
// doesn't
pform[i]->osap::askamount();
pform[i]->osap::setamount(gchar);
I am trying to help, and I'm not judging you. There are a lot of issues when answering this question. 1) There is a way to accomplish what you want, but it's frowned upon, and points to an error in your design. 2) This is a bad class hierarchy. It's not natural. It doesn't correctly model "isa". 3) What you are attempting suggests to me that a book would help you further than I could.
I dislike answering questions that further propagate a bad design, or that use techniques that aren't exactly "kosher", but here goes:
From what I gather askamount() and setamount() are part of osap, but not part of form, and you are attempting to access these methods through a base class pointer. To do this, you need to 1) add those methods to the base class as virtual or 2) cast the pointer to the derived class type, as in:
Code:
dynamic_cast<osap*>(pform[i])->askamount();
Jeff
-
thanks but what i ended up doing was putting everything i needed in the default constructers