What makes a class abstract in C++?
Correct answer
A. Declaring at least one pure virtual function, such as virtual void f() = 0;
14 views
A. Declaring at least one pure virtual function, such as virtual void f() = 0;
14 views
Abstract class cannot be instantiated because it has at least one pure virtual function, whether declared in it or inherited unimplemented. It may still define constructors and non-pure members, which derived classes use. A protected constructor by itself only blocks direct construction from outside and does not make the class abstract.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is A? Ask here and get an explanation.