#include "stdio.h"
v oid main() {
clrscr();
string s1("Operator"),s2("Overloading"),s3;
s3=s1+s2;
s3.print();
}
#include "conio.h"
#include "string.h"
#include "string.h"
class string
{
char str[20];
public:
string()
{}
string(char s[])
{
strcpy(str,s);
}
void print()
{
cout<<"\n"<
}
string operator+(string s)
{
string temp; strcpy(temp.str,str);
strcat(temp.str,s.str);
return temp;
strcat(temp.str,s.str);
return temp;
}
};
clrscr();
string s1("Operator"),s2("Overloading"),s3;
s3=s1+s2;
s3.print();
}
Output
OperatorOverloading
0 comments:
Post a Comment