this->~Employee();
What is that line? You should never call a destructor directly. This is very advanced stuff for expert only.
strlen(empName)
The above lione is incorrect. You are trying to get the length of an uninitialized string (see Solution 1).
Employee e3;
What is the purpose of creating another employee that is unused at the end of one of the constructor?
public:
char *empName;
int empRolNo;
Why are those members public? They should be private.
By the way, you should use
std::string
instead of your own string handling. Your class would look similar to this:
class Employee
{
private:
string empName;
int empRolNo;
public:
Employee()
{
cout << "Default Constructor" << endl;
empName = "Chamakuri";
empRolNo = 111;
}
Employee(const char *name,int r)
{
cout << "Param Constructor\t" << name << endl;
empName = name;
empRolNo=r;
}
~Employee()
{
cout << "Destructor\t" << empName << endl;
}
};