C++ vs C
What C++ adds to C, and what stays the same.
Easy
C++ is (almost) a superset of C. Key additions:
- classes, inheritance and virtual functions,
- references (
int &r = x;), - function and operator overloading,
- templates and the STL (
std::vector,std::map), - exceptions, namespaces,
new/delete, - RAII and smart pointers for safe resource management.
In embedded C++ developers often disable exceptions and RTTI and avoid heap allocation, but still benefit from classes, templates and constexpr.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.