C++ Programming - OOPS Concepts - Discussion

Discussion :: OOPS Concepts - General Questions (Q.No.53)


Which of the following is used to make an abstract class?

[A]. Declaring it abstract using static keyword.
[B]. Declaring it abstract using virtual keyword.
[C]. Making at least one member function as virtual function.
[D]. Making at least one member function as pure virtual function.

Answer: Option D


No answer description available for this question.

Supriya said: (Sep 16, 2012)  
Can anyone tell definition of abstract class?

Mani said: (Nov 19, 2012)  
An abstract class is a class which having both defined methods and undefined (abstract) methods. But it having at least one abstract method.

We can't create an object of abstract class directly, but we can create an object of abstract class indirectly.


An object of abstract class=An object of its sub class.


An object of abstract class=an object of that class which extends that abstract class.

Deepak said: (Dec 31, 2015)  
What is the difference between virtual function and pure virtual function?

Aby said: (Jun 5, 2016)  
Give the difference of virtual function and pure virtual function.

Hareesh said: (Sep 12, 2016)  
Virtual Function and Pure Virtual Function defers in the declaration.
Virtual Function is declared with keyword 'virtual' at the start of the declaration.
Ex : virtual return_type function_name(function arguments);

While Pure Virtual Function is declared as,
Ex : virtual return_type function_name(function arguments) = 0;

NOTE : Sometimes it has been written that pure virtual function has no function body. But this is not always true. Having a default definition of the pure virtual function is not common but it's possible.

Pavan Kumar S said: (Jul 16, 2019)  
If you don't want the object of the specific class to be declared and access the member function then the abstract class comes into play, by declaring one of the member function as a pure virtual function that function has to be implemented in other sub class, so by creating the object of other subclass we can use the function and abstraction is achieved.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.