[cpp] Person.cpp
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- #include "Person.h"
- using namespace std;
- Person::Person(){
- name = "<no name>";
- age = 0;
- }
- void Person::setName(string newName){
- name = newName;
- }
- string Person::toString(){
- stringstream info;
- info << "[name: " << name << " age: " << age << "]";
- return info.str();
- }
- string Person::getName(){
- return name;
- }
- void Person::setAge(unsigned int newAge){
- age = newAge;
- }
- unsigned int Person::getAge(){
- return age;
- }
Editor
You can edit this paste and save as new: