/*
Parameterized Constructor
Run time values
*/
#include<iostream>
#include<string.h>
using namespace std;
class Employee
{
int empid,sal;
char empname[20];
public:
Employee(int e,int s,char em[])
{
empid=e;
sal=s;
strcpy(empname,em);
}
void display()
{
cout<<"\n\n Employee id: "<<empid;
cout<<"\n Employee Name: "<<empname;
cout<<"\n Employee Salary:"<<sal;
}
};
int main()
{
int id,s;
char name[20];
cout<<"\n\n Enter Employee id,Name and Salary: ";
cin>>id>>name>>s;
Employee e(id,s,name);
e.display();
return 0;
}
Parameterized Constructor
Run time values
*/
#include<iostream>
#include<string.h>
using namespace std;
class Employee
{
int empid,sal;
char empname[20];
public:
Employee(int e,int s,char em[])
{
empid=e;
sal=s;
strcpy(empname,em);
}
void display()
{
cout<<"\n\n Employee id: "<<empid;
cout<<"\n Employee Name: "<<empname;
cout<<"\n Employee Salary:"<<sal;
}
};
int main()
{
int id,s;
char name[20];
cout<<"\n\n Enter Employee id,Name and Salary: ";
cin>>id>>name>>s;
Employee e(id,s,name);
e.display();
return 0;
}