I've got a simple program where I have two classes which are Hat and Person. Each Person has a string name, a int idNum and a hat object. Each hat simply has a string of hatType and a char of hatSize. In the main method I want to simply declare 2 people and use a display method to show the information. Here's my current code, please go easy on me I'm still new to OOP in c++.
Person Class
class Person
{
  private:
    string name;
    unsigned int idNum;
    Hat myHat;
  public:
    Person(string, unsigned int, Hat);
    void display();
};
Person::Person(string personName, unsigned int personID)
{
    name = personName;
    idNum = personID;
    myHat = hat;
}
void Person::display()
{
        cout << "Given name : " << name << endl;
        cout << "Id. number : " << idNum << endl;
        hat.display();
}
Hat Class
class Hat
{
  private:
    string hatType;
    char hatSize; // S, M, L
  public:
    Hat(string,char);
    void display();
};
Hat::Hat(string _type, char _size){
    hatType = _type;
    hatSize = _size;
}
void Hat::display()
{
    cout << "Hat type   : " << hatType << endl;
    cout << "Hat size   : " << hatSize << endl;
}
Main
int main()
{
    Person personA("Alice",12321, Hat("Trilbee",'M'));
    Person personB("Bob",2324, Hat("Ferret",'S'));
    personA.display();
    personB.display();
    return 0;
}
 
     
     
    