What is Pure Virtual Function? Why and when it is used ?
Answer Posted / ognas(shradha-asutosh)
in inheritance if the base class contains a virtual
function equating to zero, it is known also as do-nothing
function & that base class is called as abstract base class
as there are no instances or objects can be created by this
base class. And this pure virtual can be filled with the
codes in successiv derived classes accordin to the user
requirements.
The syntax of the pure virtual function is....
class class_name
{
visibility mode:\\should be protected:
virtual return_type function_name()=0;
}
new class_name : inheritance_type old class_name
{
........ //class body
........
}
| Is This Answer Correct ? | 69 Yes | 19 No |
Post New Answer View All Answers
What is static in c++?
What is the difference between prefix and postfix versions of operator++()?
What is a class definition?
What is a forward referencing and when should it be used?
What is boyce codd normal form in c++?
What are files in c++?
Write a program which is required to process the time of a clock in hours and minutes, entered from the keyboard. With this program, there are two requirements for any data entered by a user: 1. The data must be of the correct type (in this case, two ints). 2. The data must be in the correct range: this means that, for the minutes, negative numbers and any number above 59 must be rejected; for the hours, negative numbers and any number above 23 must be rejected. Output error message for invalid data input. Output the time one and a half hour after the time input. i.e. Hour: 22 Min: 32 One and a half hour after 22:32 is 00:02
How do you initialize a string in c++?
What is a responder chain?
Is there a c++ certification?
How do you declare A pointer to a function which receives nothing and returns nothing
What is abstract keyword in c++?
What is purpose of new operator?
What is null c++?
What is a constant reference?