#include<iostream> #include<string> using namespace std; class stringfun { char name[20]; public: void concatString(char a[],char b[]) { strcat(a," "); strcat(a,b); strcpy(name,a); } void display() { cout<<" Name : "<<name; } }; int main() { char str1[10],str2[10]; stringfun sf; cout<<"Enter your name:"; gets(str1); cout<<"Enter sir name:"; gets(str2); sf.concatString(str1,str2); sf.display(); return 0; }