I have read that it is not good to overuse inheritance in C++. I have a simple example where I would like to know if it is good or bad to use it to initialize values in the base class constructor.
Let's say I have a class Animal :
class Animal{
protected :
Animal(std::string name, std::string category);
std::string m_name;
std::string m_category;
};
Is it good to create a specific class for each animal the application is going to use for example :
class Bear : public Animal{
public :
Bear():Animal("Bear", "Mammal"){
}
};
Of course that means that if I have 100 animals, I need 100 classes, and that feels awkward to my eyes. In this example, I am using inheritance only to initialize values, there won't be any specific virtual methods involved.
Thanks