I have an interface class – IAnimal and 2 derived classes – Tcat and Tdog. I want both Tcat and Tdog to inherit the Eat function, however, I want Tcat to be able to have 2 parameters and Tdog to have the parameters that it inherits. Is this possible?
/// Pure virtual - to ensure all inherited animals have eat and sleep
class IAnimal
{
public:
virtual ~IAnimal() {}
virtual bool Eat(int _i_food) = 0;
virtual bool Sleep(int _i_time) = 0;
};
class TCat : public IAnimal
{
public:
bool Eat(int _i_food, int _i_amount); // can we override interface pure virtual from inherited class?
bool Sleep(int _i_time);
};
class TDog : public IAnimal
{
public:
bool Eat(int _i_food);
bool Sleep(int _i_time);
};