c++ beginner s4-class

//Person.h

#ifndef PERSON_H_
#define PERSON_H_

#include <iostream>
using namespace std;

class Person {
private:
    string name;
    int age;
    int height;

public:
    // construct init list
    Person(): name("unnamed"), age(0) {};
    Person(string name): name(name), age(0) {};

    // constructor by this
    Person(string name, int age);

    // getter / setter
    void setHeight(int height);
    string getHeight();

    // methods
    string toString();
};

#endif /* PERSON_H_ */

Last updated

Was this helpful?