[Dev-C++] accessing derived class methods
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Dane E. <dg...@wo...> - 2005-09-20 02:38:52
|
Hi all, I have a simple base class and a few derived classes from it. My goal is to build an array of pointers where I can assign derived class objects into, then access the different derived class attributes as needed. So I have an employee class. I derive a laborer, scientist, and manager class from it. I build some basic virtual functions in the employee class, and each derived class has a couple of specific attributes that I want to call, like getSpecificData(). I made an array of base class pointers then tried accessing the derived class methods, but it doesnt work. I made an array of void* pointers and tried to access derived class methods and that doesnt work. I realize that I could build a pure virtual function in the base class that would only be used to access derived class atrributes, but that is silly. Please can someone point* me in the right direction? Thanks for any help you can offer. Best regards, Dane da...@de... |