Miguel Mano Fernandes Miguel Mano Fernandes - 10 months ago 40
C++ Question

Do derived classes need their own version of a virtual function declared on base?

For instance, the class

Plant
has a
virtual void info()
method. The class
flower
derives from
Plant
.

Is
Plant
obligated to have its own implementation of the method?

Answer Source

If the function is pure virtual, that is declared virtual void info() = 0;, then No. Otherwise Yes.