What does abstraction mean in C++, and which language mechanisms help enforce it?
Show answer and explanation
Abstraction exposes a stable contract while hiding representation and implementation decisions that callers should not depend on. C++ can express it through classes with invariant-preserving public operations, free-function or module boundaries, abstract base classes for runtime polymorphism, concepts for compile-time contracts, and techniques such as Pimpl for implementation isolation. Encapsulation can enforce an abstraction boundary, but simply making data private does not by itself create a useful abstraction.
Abstraction exposes a stable contract while hiding representation and implementation decisions that callers should not depend on. C++ can express it through classes with invariant-preserving public operations, free-function or module boundaries, abstract base classes for runtime polymorphism, concepts for compile-time contracts, and techniques such as Pimpl for implementation isolation. Encapsulation can enforce an abstraction boundary, but simply making data private does not by itself create a useful abstraction.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.