Lets say I have a class Person.
class Person{
Person(std::string, int);
void walk();
void talk();
void eat();
private:
int age;
std::string() name;
};
Now lets say I want to add personality to this person object. How should add this feature to this person?
I was thinking of inheritance
class Persona: public Person{
void charisma();
void voice();
void style();
};
or should I use composition?
class Persona{
void charisma();
void voice();
void style();
};
class Person{
.....
private:
int age;
std::string name;
Persona _persona;
};
or should I just add the new feature directly to the class Person
, which I really don't want because this will make my class Person
big and clumsy.
One thing that I came across was Decorator Pattern but I am still wondering if this pattern is of any help for me.
charisma()
do? It doesn't return anything.