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


Please Help Members By Posting Answers For Below Questions

What is ofstream c++?

589


What is searching? Explain linear and binary search.

588


What is called array?

624


True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends

1869


I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?

1587






When can I use a forward declaration?

626


There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.

2535


How do we balance an AVL Tree in C++?

643


What is anonymous object in c++?

632


Is overriding possible in c++?

578


Can I create my own functions in c++?

605


What is the fastest c++ compiler?

589


What is the use of dot in c++?

625


Does c++ have string data type?

695


Mention the ways in which parameterized can be invoked. Give an example of each.

576