For C++ Classes

  1. Heade File:

#ifndef PERSON_H
#define PERSON_H

#include <string>

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

public:
    Person(const std::string& name, int age);
    
    void setName(const std::string& name);
    std::string getName() const;
    
    void setAge(int age);
    int getAge() const;
    
    void introduce() const;
};

#endif // PERSON_H
  1. Header Implementation:

  1. Main

Last updated