Write a C++ Program for Conversion CLASS TO BASIC : String object to basic string
//Conversion CLASS TO BASIC
//String object to basic string
#include
#include
#include
class string
{
char *p;
int len;
public:
string()
{}
string(char *a)
{
len=strlen(a);
p=new char[len+1];
strcpy(p,a);
}
operator char*()
{
return(p);
}
void display()
{
cout<
}
};
void main()
{
clrscr();
string o1="vivek";
cout<<"String of Class type : ";
o1.display();
cout<
char *str=o1;
cout<<"String of Basic type : "<
getch();
}