CurriculumAbstraction
Abstraction
<strong>Abstraction</strong> hides complex implementation details and exposes a simple, clean interface. Users should not need to know HOW it works, just WHAT it does.
01Abstract Classes
A class with at least one pure virtual function is abstract. It defines a contract all derived classes MUST fulfill. Cannot be instantiated directly.
main.cpp
Terminal
Waiting for execution...
02Interface Pattern
An abstract class with ONLY pure virtual functions is a pure interface - a contract. IDrawable means you MUST have draw().
main.cpp
Terminal
Waiting for execution...
03Polymorphism Through Abstraction
Store different types in one collection and call the same function. Each type implements it differently.
main.cpp
Terminal
Waiting for execution...
04Concrete vs Abstract Classes
A Concrete class implements ALL pure virtuals so you CAN create objects from it. An Abstract class has at least one un-implemented pure virtual.
main.cpp
Terminal
Waiting for execution...
AI Tutor
When you call std::cout you don't know how it talks to the OS. When you call .push_back() you don't know about memory reallocation. That IS abstraction.