1 error

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include<iostream.h>
#include<string.h>
#include<conio.h>
const int len=30;
enum contract{permanent,temporary};
class Employee{
	protected:
	char name[len];
	long int ID;
	double salary;
	public:
	Employee() **}
	Employee(char n[len],long int id, double s)**
	strcpy(name,n);
	ID=id;
	salary=s;}
	void setEmp(char [len],long int id,double s) **
		cout<<"\nName of Employee: "<<name;
		cout<<"\nID of Employee: "<<ID;
		cout<<"\nSalary of Employee: "<<salary;
	}
	friend ostream& operator << (ostream&,Employee &);
};
ostream& operator << (ostream & out,Employee & n) **
			out <<n.name<<"----" <<n.ID<<"-----"<<n.salary<<endl;
			return out;
		}
class Manager: public Employee **
	private:
	char degree[len];
	public:
	Manager (char n[len],long int id,double s,char d[len])**
	Employee::Employee(n,id,s);
	strcpy(degree,d);}
	void setEmp(char n[len], long int id, double s, char d)**
		Employee::setEmp(n,id,s);
		cout<<"\nDegree of Employee: "<<degree;
	}
	friend ostream& operator << (ostream&,Manager &);
};
ostream& operator << (ostream & out,Manager & n) **
			out <<n.name<<"----" <<n.ID<<"-----"<<n.salary<<"-----"<<n.degree<<endl;
			return out;
		}
class Secretary: public Employee **
       private:
	contract contractType;
       public:
	Secretary(char n[len],long int id, double s,contract c)**
		Employee::Employee(n,id,s);
		contractType=c;}
	void setEmp(char n[len], long int id, double s, contract c)**
		Employee::setEmp(n,id,s);
		cout<<"\nContract Type of Employee: "<<contractType;
	}
	friend ostream& operator << (ostream&,Secretary &);
};
ostream& operator << (ostream & out,Secretary & n) **
			out <<n.name<<"----" <<n.ID<<"-----"<<n.salary<<"----"<<n.contractType<<endl;
			return out;
		}
int main() **
	Employee p( "Silva", 1234567, 500.0);
	Manager p1( "Silva Mikaido",234567, 1000.0, "Dr.");
	Secretary p2;
	p2.setEmp( "Sizer", 341256, 400.0,permanent);
	cout<< "Manager p1 is "<<p1;
	cout<< "Secretary p2 is "<<p2;
	return 0;
}


When compile 1 error appear:
"Could not find a match for 'Secretary:Secretary()'
Help me correct it !
Last edited on
You don't have a constructor which takes no arguments for class 'Secretary' ( Secretary(char n[len],long int id, double s,contract c) ) so the error occurs on line 65: Secretary p2;

1
2
#include<iostream.h>
#include<string.h> 
modern C++ has <iostream> and <string> with no .h and then the std namespace

Why do you have ** instead of { ?

Last edited on
Help me complete it !
Help me complete it !


You want anything else with it too sir !
I guess Bazzy already showed you the right direction. If you expect to get the complete working solution then you are in the wrong forum mate.
Last edited on
Topic archived. No new replies allowed.