Test yourself under real exam conditions: 50 timed questions, 60 on the clock, pass mark 70%%. Instant score with a full review of everything you got wrong. Free — no account needed.
Exam details
The four pillars of OOP are:
A class is a user-defined type that encapsulates data members and member functions. Defined with the class keyword:class MyClass { public: int x; void show(); };
The only default difference is access control:
class members are private by defaultstruct members are public by defaultInheritance allows a derived class to inherit members from a base class:class Dog : public Animal { };
This promotes code reuse and establishes an is-a relationship.
A virtual function is declared with the virtual keyword in a base class, enabling runtime polymorphism:virtual void speak() { }
Derived classes can override it, and the correct version is called via a base class pointer using the vtable.