#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()'
Please correct it for me !

Your class doesn't have a default constructor taking no arguments, and you have to use an existing constructor to make an object. You declare and intialize your employee and manager with constructors with arguments, and you have to for your secretary as well. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.