Arrays with base/derived classes
I need some help. I have been tackling this in my head for a while now and I am sure someone out there has my answer on tap. So here goes.
I am creating a simple employee storage program.
I have an employee base class and 4 derived classes with specialized attributes.
I have created all of my classes and created my constructors/gets/sets etc...
I am having trouble with the following
I have two simple public methods called
getEmployeeInfo and displayEmployee
They are first declared in my base class Employee and then overridden in all of my four derived classes.
So here is the question you have all been waiting for.
How can I create an array to hold all of my objects whether they are a Manager or Support or Hardware etc. And how can I go about making sure the correct displayEmployee method is called based on the object type in the array.
If you need more explanation please let me know.
Thanks in advance for any help, tips, or advice.