Why pure virtual functions are used if they don't have implementation / When does a pure virtual function become useful?

Answer Posted / hrpynux@gmail.com

A pure virtual function makes it so the base class can not be instantiated, and the derived classes are forced to define these functions before they can be instantiated. This helps ensure the derived classes do not forget to redefine functions that the base class was expecting them to.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is the best c++ software?

609


What is the difference between c++ and turbo c++?

588


In a function declaration what does extern means?

598


Can you please explain the difference between using macro and inline functions?

528


What are the main features of c++?

544






Do you know what are static and dynamic type checking?

618


What is #include iostream?

735


Is c++ a programming language?

594


What is == in programming?

614


What is void pointer in c++ with example?

596


Write a program to interchange 2 variables without using the third one.

588


Do the names of parameters have to agree in the prototype, definition, and call to the function?

599


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

792


How do you master coding?

562


Which c++ operator cannot overload?

549