#include<iostream.h>
#include<conio.h>
#include<string.h>
class string
{
char *nm;
int len;
public:
string(char *s)
{
len=strlen(s);
nm=new char[len+ 1];
strcpy(nm,s);
}
void com(string &ss2)
{
int k;
k=strcmp(nm,ss2.nm);
if(k==0)
cout<<"\nBoth objects have same name";
else
cout<<"\nBoth objects have different name";
}
void put()
{
cout<<"\nName of person : "<<nm;
}
~string()
{
cout<<"\nRelease memory allocated to"<<nm;
delete[] nm;
}
};
void main()
{
clrscr();
string obj1 ("Dinesh");
string obj2("Thakur");
obj1.put();
obj2.put();
obj1.com(obj2);
getch();
}