What is Pure Virtual Function? Why and when it is used ?
Answer Posted / mahfuzur rahman
Virtual function vs pure virtual function :
Virtual function :-
1. Virtual function have a function body.
2. Overloaded can be done by the virtual funciton.
(Optional)
3. It is define as : virtual int myfunction();
Pure virtual function :-
1. Pure virtual function have no function body.
2. Overloading is must in pure virtual funciton. (Must)
3. It is define as : virtual int myfunction() = 0;
4. A class is "abstract class" when it has at least one
pure virtual function.
5. You cann't create instance of "abstract class", rather
you have to inherit the "abstract class" and overload all
pure virtual function.
Like :- CControlBar class is an "abstract class".
Is This Answer Correct ? | 144 Yes | 24 No |
Post New Answer View All Answers
What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
Write my own zero-argument manipulator that should work same as hex?
What is meant by a delegate?
Write a program to find the Fibonacci series recursively.
How many characters are recognized by ANSI C++?
Describe the advantages of operator overloading?
What is a local reference?
What is the function to call to turn an ascii string into a long?
What is scope operator in c++?
write a porgram in c++ that reads an integer and print the biggest digit in the number
What is c++ similar to?
What are put and get pointers?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
Why c++ is created?
Is c++ an integer?