Object-oriented programming
OOP rounds in campus placements and university exams ask about language mechanisms by name: virtual functions, vtables, the diamond problem, abstract classes versus interfaces, overloading versus overriding. This course explains how each one works in C++, Java and Python, so you can answer the follow-up question as well as the first one.
Start the course
Lessons
Objects, classes and encapsulation
State and behaviour, class invariants, access control in C++, Java and Python, and why a getter and setter for every field is not encapsulation.
Object lifetime: construction, destruction and copying
Constructors and initialization order, destructors and RAII, garbage collection, shallow and deep copies, the rule of three/five/zero, and equals and hashCode.
Inheritance and multiple inheritance
What a subclass inherits, constructor chaining, protected members, and the diamond problem in C++, Java and Python’s C3 method resolution order.
Polymorphism: overloading, overriding and vtables
Overloading versus overriding, static and dynamic dispatch, how vtables and vptrs implement virtual calls, virtual destructors, object slicing and duck typing.
Abstract classes and interfaces
Pure virtual functions, Java abstract classes versus interfaces with default methods, Python ABCs and protocols, and how to choose between them.
Composition over inheritance
The fragile base class problem, classes that inherit too much, the Liskov substitution principle with a concrete violation, delegation and refactoring a hierarchy into composition.
OOP interview questions, answered by mechanism
Static members, this and self, final and sealed, friend, early and late binding, and constructors that throw, each explained by how the language implements it.
Interview Prep pass · Compare plans