67 238
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #31783 in C++ for Jay

Question #31783
Implement all member functions of the following class:
class Person
{
public:
Person();
Person(string pname, int page);
void get_name() const;
void get_age() const;
private:
string name;
int age; // 0 if unknown
};
Expert's answer
#include <string>
using namespace std;

class Person
{
public:
Person();
Person(string pname, int page);
string get_name() const;
int get_age() const;
private:
string name;
int age; // 0 if unknown
};


Person::Person() {
name = "";
age = 0;
}

Person::Person(string pname, int page) {
name = pname;
age = page;
}

string Person::get_name() const {
return name;
}

int Person::get_age() const {
return age;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions