What is Pure Virtual Function? Why and when it is used ?

Answer Posted / prajesh gupta (ferozepur, punj

Pure Virtual Functions:
1. "Do nothing Function"
virtual void display() = 0;
2. declared in base class.
3. class containing a pure virtual function does not
declare an object of its own. (That class is known as
ABSTRACT CLASS)

Advantages Of Using:

1. To inherit the properties of the derived class.
2. To create a base pointer required for runtime
poymorphism.
3. To avoid overwriting of member function.

Is This Answer Correct ?    37 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are arrays c++?

616


What is fflush c++?

586


Explain what are accessor methods?

675


What is the output of the following program? Why?

630


What is a lambda function c++?

560






Define token in c++.

725


What is the maximum value of a unsigned char a) 255 b) 256 c) 128

640


Does c++ have string data type?

699


Is c++ the hardest programming language?

648


Will this c++ program execute or not?

613


How to implement is-a and has-a class relationships?

593


What is dev c++ used for?

611


How static variables and local variablesare similar and dissimilar?

571


How can you differentiate between inheritance and implementation in c++?

649


Describe the advantage of an external iterator.

621