You don't have to define it in base class. However, you will not be able to call this method on base class pointer or reference though. The function doesn't need to be virtual.
class Fruit {};
class Apple : public Fruit
{
public:
void Taste();
}
class Orange : public Fruit {}
class Mango : public Fruit {}
Fruit* f = new Apple();
f->Taste(); // Error
Apple* a = new Apple();
a->Taste() // Ok
If however you want to have access to the method from base class pointer or reference, you need to define a empty implementation of a virtual method in base class and override it in Apple class.
class Fruit
{
public:
virtual void Taste() {}
};
class Apple : public Fruit
{
public:
virtual void Taste()
{
// Do something.
}
}
class Orange : public Fruit {}
class Mango : public Fruit {}
Fruit* f = new Apple();
f->Taste(); // Ok
Fruit* f2 = new Orange();
f2->Taste(); // Ok and no side effect.