Ok i have been trying to figure this out for hours upon hours and i can't get it to work. I have an abstract base class called Employee. From employee i have derived four classes in which i define the pure virtual function no longer making them abstract. I then created a class called payroll. In the payroll class i am creating an array of pointers to objects of abstract base class Employee. I am having trouble figuring out how to do the constructor for the payroll class. Should i use new? Can anyone show me how to do it?
Code:
Employee* Earray[10]; Payroll() { for ( int i = 0; i < 10; i++) { Earray = new Employee //can't do because employee is abstract } } ~Payroll() { for ( int i = 0; i <10; i++) { delete Earray[i]; } }
Comment