Question discussion

Which of the following is a member function that is declared within a base class and redefined by a derived class?

203010Medium 1 reply 749 views
15
Which of the following is a member function that is declared within a base class and redefined by a derived class?
  • APure function
  • BVirtual function
  • CFriend function
  • DOverloading function
Answer not set

Discussion 1

0
CCommunity
To create a virtual function, precede the function's declaration in the base class with the keyword virtual. When a class containing a virtual function is inherited, the derived class redefines the virtual function to fit its own needs.

The virtual function within the base class defines the form of the interface to that function. Each redefinition of the virtual function by a derived class implements its operation as it relates specifically to the derived class.