operator overload string concatenate
#include <iostream>
#include <string.h>
using namespace std;
class Name
{
public:
char x[100];
Name(){}
Name(char x[])
{
strcpy(this->x,x);
}
Name operator+(Name&y)
{
Name fullname;
strcat(this->x," ");
strcat(this->x,y.x);
strcpy(fullname.x,this->x);
return fullname;
}
};
int main()
{
char fname[10], lname[10];
cin>>fname>>lname;
Name f(fname);
Name l(lname);
Name final=f+l;
cout<<final.x;
return 0;
}