Find the wrong statement about Abstract Class ?



Find the wrong statement about Abstract Class ?

A. We can’t create its objects

B. We can’t create pointers to an abstract class

C. It contains at least one pure virtual function

D. We can create references to an abstract class

Answer : B. We can’t create pointers to an abstract class


Explanation :

  • Abstract Class is a class which contains atleast one Pure Virtual function.
  • An abstract class is a class that is designed to be specifically used as a base class.
  • It is used to provide an Interface for its sub classes.
  • Classes inheriting an Abstract Class must provide definition to the pure virtual function, otherwise they will also become abstract class.
  • You declare a pure virtual function by using a pure specifier (= 0) in the declaration of a virtual member function in the class declaration.

Example

class AB {
public:
  virtual void f() = 0;
};

Related Searches to Find the wrong statement about Abstract Class ?