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
What are the advantages of pointers?
What is abstract keyword in c++?
write a c++ program to create class student having datamember name,Roll_no,age,and branch intilcization all the member using constructor print the all the details on the screen.
Why is c++ still used?
Are c and c++ similar?
What is function declaration in c++ with example?
Differentiate between an array and a list?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
What does iomanip mean in c++?
What is pointer to member?
A prime number is a number which is divisible only by itself and 1. Examples of the first few primes are 2, 3, 5, 7, 11. Consider writing a program which can generate prime numbers for you. Your program should read in and set a maximum prime to generate and a minimum number to start with when looking for primes. This program should be able to perform the following tasks: 1. Read the maximum number from user (keyboard input) to look for primes. The program should not return any primes greater than this number. 2. Read the minimum number from user (keyboard input) to look for primes. The program should not return any primes less than this number. 3. Generate and print out every prime number between the maximum prime and minimum number specified by the user.
What is a class template?
What is the size of integer variable?
When does the c++ compiler create temporary variables?
What is null pointer and void pointer?