Difficulty: Easy
Correct Answer: Abstract class
Explanation:
Introduction / Context:
In object oriented C plus plus programming, classes are the main way to model real world entities. Not all classes are meant to be instantiated directly. Some classes act only as blueprints for derived classes and exist mainly to define common interfaces. Such classes usually contain pure virtual functions and are known by a special name. This question checks whether you know what these special non instantiable classes are called in C plus plus.
Given Data / Assumptions:
Concept / Approach:
In C plus plus, a pure virtual function is declared by assigning 0 in its declaration, for example virtual void draw() = 0. A class that contains at least one pure virtual function is special. The compiler treats such a class as non instantiable. In object oriented terminology, a class that cannot be instantiated and that is meant only to be inherited from is called an abstract class. The correct option must therefore be the name that matches this concept and not other unrelated class categories.
Step-by-Step Solution:
Step 1 Identify what a pure virtual function means. It is a virtual function with no implementation in the base class and is declared using = 0.
Step 2 Recall the rule in C plus plus that any class containing at least one pure virtual function cannot be instantiated directly.
Step 3 Remember the terminology that such non instantiable classes that act as bases for derived classes are referred to as abstract classes.
Step 4 Compare each option and select the one that literally names this concept, which is Abstract class.
Verification / Alternative check:
A quick verification is to recall examples from C plus plus libraries or textbooks. Whenever a class has a pure virtual function and is used only as a base class, it is described as an abstract class. If you try to create an object of such a class, the compiler gives an error saying that the class is abstract. This behavior confirms that the correct term is Abstract class and not any of the other options.
Why Other Options Are Wrong:
Concrete class is the opposite of an abstract class and can be instantiated, so it is not correct. Static class is not a standard C plus plus term in this context and refers instead to static members or to concepts in other languages. Friend class refers to a class that has special access privileges to another class and has nothing to do with pure virtual functions. Interface class is an informal term used by some programmers, but the precise C plus plus term is abstract class, so it is not the best answer here.
Common Pitfalls:
Learners often confuse abstract class with interface, especially if they come from languages where interface is a keyword. Another common mistake is to assume that any class with virtual functions is abstract, which is not true because only pure virtual functions enforce non instantiability. Some students also misinterpret friend class as something fundamental to inheritance rather than access control. Keeping the formal C plus plus definition in mind avoids these errors.
Final Answer:
The class that contains at least one pure virtual function and cannot be instantiated directly is called an Abstract class.
Discussion & Comments