Object-Oriented Programming
12 Topics
1
Classes and Objects
Defining classes and creating objects
Core OOP concept
2
Access Specifiers
public, private, and protected — controlling member visibility and encapsulation
Core encapsulation concept — every OOP interview discusses access control
3
Constructors
Default, parameterized, and copy constructors
Object initialization
4
Destructors
Automatic cleanup when objects go out of scope or are deleted
Core C++ memory management — virtual destructor rule, noexcept, and RAII
5
this Pointer
The implicit pointer to the current object in member functions
Understanding self-reference, method chaining, and disambiguating member vs local names
6
Static Members
Class-level variables and methods shared across all instances
Shared state, singleton pattern, and class-level counters are common interview topics
7
Friend Functions and Classes
Granting external access to private members when encapsulation needs to be relaxed
Access control design — when to use friend, operator<< pattern, and why friend is not a design smell when used correctly
8
Operator Overloading
Defining custom behavior for C++ operators on user-defined types
C++ specific — overloading operators for custom types, member vs non-member, C++20 spaceship operator
9
Inheritance
Code reuse through inheritance
Core OOP pillar
10
Polymorphism
Virtual functions and runtime polymorphism
Critical OOP concept
11
Abstract Classes
Pure virtual functions and interface contracts — cannot be instantiated
OOP design — abstract classes vs interfaces, pure virtual, and how to enforce implementation contracts
12
Multiple Inheritance
Inheriting from multiple base classes — power and pitfalls including the diamond problem
Diamond problem, virtual inheritance, and interface implementation — advanced OOP interview topic