#include<iostream.h>
#include<string.h>
#include<conio.h>
class mystring
{
char str[30];
int len;
public:
void accept()
{
cout<<"\n\nEnter the string : ";
cin>>str;
}
mystring operator+(mystring);
void disp()
{
cout<<str;
}
};

mystring mystring::operator +(mystring s)
{
mystring temp;
strcpy(temp.str,str);
strcat(temp.str,s.str);
return temp;

}
int main()
{
clrscr();
mystring str1,str2,str3;
str1.accept();
str2.accept();
str3=str1+str2;
cout<<"\n\nFirst string is  : ";
str1.disp();
cout<<"\n\nsecond string is : ";
str2.disp();
cout<<"\n\nConcatination of two string is : ";
str3.disp();
getch();
return 0;
}

Post a Comment

Previous Post Next Post