C++ this pointer, Abstract Classes & Functions Interview Questions
C++ 'this' Pointer
Basic Level (15 Questions)
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Tricky Level (10 Questions)
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Review question
Review the tutorial for this topic.
Can an abstract class have constructors?
Yes. Constructors run when concrete derived objects are created; abstract base still initializes subobjects.
What is interface class idiom?
Class with only pure virtual functions and a virtual destructor—no data members—defines a contract.
Difference between pure virtual and virtual with body?
Pure virtual (= 0) makes class abstract; you can still provide out-of-line definition called explicitly.
Can you instantiate class with only defaulted destructor?
If no pure virtual functions remain, yes—abstractness requires at least one unimplemented pure virtual in the hierarchy.
Why provide virtual destructor in abstract base?
Ensures correct cleanup when deleting through base pointer to derived object.
Note: These questions cover advanced C++ OOP concepts including the 'this' pointer, base class access (similar to 'super' in other languages), and abstract classes with pure virtual functions. Understanding these concepts is crucial for implementing polymorphism and proper class design in C++. This page lists 15 basic and 10 tricky questions—use the tutorial and MCQ links above and below.