Primary-expression error in implementation file.

Good day. I am having an issue with a derived class constructor. When i run the code from my IDE it gives me the following error.
"error:expected primary-expression before 'double' "

As far as I know the format of defining a derived constructor is correct in the code so I am unsure what the issue is.

My playing around with the error line showed me that the error is to do with the "Employee" class in the constructor definition. So perhaps it is not identifying the parent class?

Any assistance is appreciated, thank you.

ManagerImplement.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "employee.h"
#include "manager_class.h"
#include <iostream>
using namespace std;

Manager::Manager(): Employee()
{
  allowance = 0;
}

Manager::Manager(double salary1,double  pension1,double  medical1,double  tax1,double  allow):Employee(double  salary,double  pension,double  medical,double  tax)
{
 allowance = allow;
}

I left out some other function definitions that worked fine.


manager_class.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef MANAGER_CLASS_H
#define MANAGER_CLASS_H
#include "employee.h"
#include<iostream>
using namespace std;
//    Derived         Parent
class Manager: public Employee
{
public:
    Manager();
    Manager(double salary1, double pension1, double medical1, double tax1, double allowance);

    void Display();
    double calcTax();
    double calcGrossPay();
    double getAllowance();
    void setAllowance(double allow);
    ~Manager();
private:
    double allowance;
};
#endif 

On which line, in which file, is the error?
I'm so sorry I am such an idiot. It's in the first file line 11
.
Last edited on
When passing the parameter to Employee (line 11, ManagerImplement.cpp) you need to omit the types.
I removed the doubles from the employee constructor parameters and now i have this error.

"ManagerImplement.cpp line 11 error: 'salary' was not declared in this scope"
It does this with all the other parameters too.
Last edited on
salary ... or salary1 ?
@lastchance Ohhhhhh I got it thank you. It SHOULD have been salary1 this whole time. I've been putting this issue off for a week.
Topic archived. No new replies allowed.