Wrtie a C++ Program for Conversion BASIC TO CLASS TYPE
//Conversion BASIC TO CLASS TYPE
//string to class object
#include
#include
#include
class string
{
char *p;
int len;
public:
string::string()
{}
string::string(char *a)
{
len=strlen(a);
p=new char[len+1];
strcpy(p,a);
}
void display()
{
cout<
}
};
void main()
{
clrscr();
string s1,s2;
char *name1="vivek";
char *name2="patel";
s1=string(name1); //Invoke constructor
s2=name2; //Invoke constructor
s1.display();
cout<
s2.display();
getch();
}