problem with classes....help please

hello everyone....i have a question...i have two classes

class resident
{
int age;
std::string name;
public:
resident(int a,std::string n):age(a),name(n) {}
virtual std::string getname() { return name; }

};

class old_resident:public resident
{
int stipend;
public:
old_resident(int a,std::string n,int s):resident(a,n),stipend(s) {}

std::string getname() { return ??????; }

};

look...in my second class i want to return " name " but don't know how...i'll be very thankful if anyone help me
This maybe:
1
2
3
4
std::string getname() { 
resident b;
string c;
return b.name(c); } 
Make std::string name protected.
Helegurbann thank you very much but "name" was a private member, not function....
and thank you very much Caligulaminus.....you helped me
Topic archived. No new replies allowed.