C++ extends C with classes, templates and a large standard library while keeping control of memory and cost. It is used where performance and resources matter: game engines, browsers, databases, trading systems and embedded software. It is a big language with several styles, and modern practice is to avoid the raw, C-like ways of managing memory.
Key concepts
- RAII: resources such as memory, files and locks are owned by objects and released when they go out of scope.
- Value semantics: copying, moving and ownership are explicit, with constructors, destructors and move operations.
- Templates and generic programming: code written once for many types, resolved at compile time.
- Standard library: containers, algorithms, strings and smart pointers, which replace most hand-written code.
- Classes and polymorphism: inheritance and virtual functions for runtime dispatch, used with restraint.
- Zero-cost abstraction: you do not pay for features you do not use.
Vocabulary
- Smart pointer: an object that owns heap memory and frees it automatically.
- Move semantics: transferring a resource instead of copying it.
- Undefined behaviour: code the standard gives no meaning to, as in C.
- Header and translation unit: how declarations are shared and compiled.
What to study, in order
- Basic C++ with the standard library: strings, vectors and maps, with no raw new or delete.
- Classes, constructors, destructors and RAII; write a small resource-owning class.
- Copy and move rules, and why smart pointers usually replace raw pointers.
- Templates: write a generic container and a function template.
- Standard algorithms and iterators; replace hand-written loops with them.
- Build a larger project with a build tool, warnings on and sanitisers enabled.