What is making this an abstract class?

I'm working on a project that deal a lot with inheritance, I have this base class "Employee" and a derived class "Manager" and whenever I try to create a new manager in the main class it tells I cant because its an abstract class. I ran into the same problem earlier in this program when I was creating the The different kinds of sale objects but I fixed it after I figured out I didn't have all my pure virtual functions defined in the derived classed of Sale. In this case though I have all the virtual function defined in the derived classes so I'm not sure what is making "Manager" abstract.. Any help clearing this up would be greatly appreciated

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Manager: public Employee{
private:
    float staff_commission;
    vector<Salesperson *> staff_list;
public:
    // Constructors
    Manager(): Employee(){ };
    Manager(string fn, string ln, float bs): Employee(fn, ln, bs){
        Manager::setCommission();
        commission = Manager::getCommission();
        total_salary = getTotalSalary();
    };
    
    virtual ostream &print_info( ostream & ) = 0;
    virtual ostream &print_employee_sales( ostream & ) = 0;
    virtual ostream &print_staff_sales( ostream & ) = 0;
    
    // Sets managers commission based off of individual sales and their staffs individual sales
    virtual void setCommission();
    
    // Adds a saleperson to a list of employees this manager is in charge of.
    void addSalesperson( Salesperson );
};

And as a side note, all 3 of the virtual print methods are called in the overloaded output operator in the namespaces.
Last edited on
If a class has pure virtual functions then that class is an abstract class so you can't create objects of the class. Remove = 0; after the function declarations in Manager to make them not "pure".
Wow haha I totally missed that, thanks for pointing that out! I guess that'll teach to me check things over after I copy and paste out of another class! That should do the trick
Topic archived. No new replies allowed.