i should be getting firstname, middlename and surname all together as output.... but im getting only the middlename and surname... where am i wrong???
Code:
#include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;
class name
{
public:
string first;
string m;
string l;
string name1;
name()
{
cout<<"enter first name :";
cin>>first;
}
name(string mno,string abc)
{
m=mno;
l=abc;
}
name(name &z)
{
name1=z.m+z.l;
}
void show()
{
string fullname=first+name1;
cout<<"\nfull name :"<<fullname;
}
};
main()
{
string mid;
string sur;
name n;
cout<<"enter middle name :";
cin>>mid;
cout<<"\nenter surname :";
cin>>sur;
name n1(mid,sur);
name n2(n1);
n2.show();
getch();
return 0;
}