~cpp
#include<iostream.h>
#include<string.h>
#define MAX_LEN 81
class person{
protected:
char fname[MAX_LEN];
char lname[MAX_LEN];
int age;
public:
void set_fname( char fn[] ) { strcpy(fname, fn); };
void set_lname( char ln[] ) { strcpy(lname, ln); };
void set_age( int a ) { age=a; };
char *get_name( char *fullname );
int get_age(void) {return age;};
person(char fn[] = "blank", char ln[] = "blank");
};
person::person( char fn[],char ln[] )
{
strcpy(fname, fn);
strcpy(lname, ln);
age = -1;
}
char *person::get_name(char fullname[])
{
strcpy(fullname, fname);
strcat(fullname, " ");
strcat(fullname, lname);
return fullname;
}
~cpp
int main()
{
char full[MAX_LEN+MAX_LEN];
person cho("Cho", "JaeHwa");
cho.set_age(19);
person blank;
cout<<"\nperson cho : "<<cho.get_name(full);
cout<<endl<<"age : "<<cho.get_age();
cout<<"\nperson blank : "<<blank.get_name(full);
cout<<endl<<"age : "<<blank.get_age();
cout<<endl;
return 0;
}