class Employee
{
char *name;
double salary;
public:
Employee();
Employee(char nm[], double sal);
Employee(const Employee& other);
const char * getName() const;
double getSalary() const;
void setSalary(double newSalary);
void operator=(const Employee& other);
~Employee();
};
Implementation of second constructor and the destructor:
Employee::Employee(char nm[], double sal)
{
name = new char[strlen(nm) + 1];
strcpy(name, nm);
salary = sal;
}
Employee::~Employee()
{
delete [] name;
}