Shahid,
Search for the word "Change" in the following code to see my changes. Also, I added a mock definition for the input function.
Take care,
Bruce
//Header Files
#include<iostream.h>
#include<conio.h> // Changed from conio.c
//class definition
class Employee{
//hidden part of the class Employee
private:
int id;
char name;
int sal;
char address;
public:
void setid(int);
void setname(char);
void setsal(int);
void setaddress(char);
int getid();
char getname();
int getsal();
char getaddress();
//to input data
void input();
//to display data values
void display();
void checkmanger();
int numberCheck(char temp[]);
Employee();
~Employee();
};
Employee::Employee()
{
id=0;
name=0;
sal=0;
address=0;
cout<<"\n \t \t constructor called"<<endl;
cout<<"\t \t ===================== \n"<<endl;
}
Employee::~Employee()
{
cout<<"\t \t The object has been destroyed"<<endl;
cout<<"\t \t ============================ \n"<<endl;
getch();
}
void Employee::display()
{
//input(); // Changed - omitted line because an input funtion is declared but not defined.
cout<<"\t===================================================="<<"\n"<<endl;
cout<<"\t Employee id: "<<getid()<<"\n"<<endl;
cout<<"\t Employee name: "<<getname()<<"\n"<<endl;
cout<<"\t Employee salary: "<<getsal()<<"\n"<<endl;
cout<<"\t Employee address: "<<getaddress()<<"\n"<<endl;
}
void Employee::input()
{
//input(); // Changed - omitted line because an input funtion is declared but not defined.
//cout<<"\t===================================================="<<"\n"<<endl;
setid(100);
setname('G');
setsal(25000);
setaddress('M');
}
void Employee::setid(int r)
{
id=r;
}
int Employee::getid()
{
return id;
}
void Employee::setname(char n)
{
name=n;
}
char Employee::getname()
{
return name;
}
void Employee::setsal(int s)
{
sal=s;
}
int Employee::getsal()
{
return sal;
}
void Employee::setaddress(char a)
{
address=a;
}
char Employee::getaddress()
{
return address;
}
void Employee::checkmanger()
{
//int salary; // Changed - omitted this line
if(sal<=0) // Changed - salary to sal
cout<<"\t The employee is programmer"<<"\n"<<endl;
else
cout<<"\t The Employee managerer: "<<sal<<"\n"<<endl; // Changed - salary to sal
}
//main function
void main()
{
// declaring object of the class Employee
Employee Emp;
//calling function input
Emp.input();
//calling function display
Emp.display();
//calling function checkmanger
Emp.checkmanger();
}
<< moderator edit: added code tags : [code][/code] >>