What is Pure Virtual Function? Why and when it is used ?
Answer Posted / shakti singh
A virtual function in a base class which is equated to 0 is called a pure virtual function.The class then is called a Abstract Base Class or in general ABC.No object of such class can be instantiated.ABC in general acts as an interface and implement the general flow of algorithm.A pure virtual function must be overloaded in the derived class otherwise the compiler will throw an error.
A pure virtual function do nothing and it is not concerned with the implementation detail.
| Is This Answer Correct ? | 13 Yes | 5 No |
Post New Answer View All Answers
What is setiosflags c++?
Can turbo c++ run c program?
What is the error in the code below and how should it be corrected?
What is a dangling pointer in c++?
What are the advantages of using friend classes?
What is abstract class in c++?
What are friend classes?
What is function prototyping?
Are strings mutable in c++?
Why is it called c++?
Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300
What is static in c++?
What are c++ redistributables?
Explain how overloading takes place in c++?
What relational operators if statements in c++?