What is C++ and Why It Exists
C++ is a **statically-typed, compiled, general-purpose** programming language created by Bjarne Stroustrup in 1979 as 'C with Classes'. It sits at a unique position: it gives you the low-level memory control of C while providing high-level abstractions (classes, templates, STL) that let you write expressive, maintainable code. C++ is the language of game engines (Unreal), operating systems (parts of Windows/macOS/Linux), browsers (Chrome's V8 rendering), databases (MySQL), and embedded firmware.
C++ vs C vs Java vs Python
// C++ occupies a unique design space
// C: Low-level, manual memory, no OOP, no templates
// Java: High-level, GC, JVM, slow startup, verbose
// Python: Very high-level, interpreted, dynamic typing, slow
// C++: Low-level control + high-level abstractions + zero-overhead
// The "zero-overhead principle" (Stroustrup):
// "What you don't use, you don't pay for."
// "What you do use, you couldn't hand-code any better."
// Example: std::sort is as fast as the best hand-written sort.
// Example: A virtual function call costs exactly one pointer dereference.
// Example: A template adds zero runtime cost — only compile-time cost.
// C++ versions to know:
// C++98/03 — original standard
// C++11 — major revolution: auto, lambdas, move semantics, smart ptrs
// C++14 — refinements: generic lambdas, make_unique
// C++17 — structured bindings, if constexpr, std::optional, filesystem
// C++20 — concepts, ranges, coroutines, modules
// Default for this course: C++17 (universally supported)Common Mistakes
- Using an outdated C++ standard flag — always compile with at least `-std=c++17`. The default in older g++ installations is C++98 which lacks auto, move semantics, and smart pointers.
- Mixing C-style code (raw pointers, printf, malloc) into modern C++ — not everything that compiles is good C++. Prefer std::string over char*, cout over printf, and smart pointers over raw new/delete.
- Thinking C++ is 'just C with classes' — C++ has evolved enormously. Modern C++ (C++11+) is almost a different language from C++98.
Tip
Tip
Practice What is C and Why It Exists in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
The four pillars of Object-Oriented Programming in C++
Practice Task
Note
Practice Task — (1) Write a working example of What is C and Why It Exists from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Quick Quiz
Common Mistake
Warning
A common mistake with What is C and Why It Exists is skipping edge case testing — empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready cpp code.
Key Takeaways
- C++ is a **statically-typed, compiled, general-purpose** programming language created by Bjarne Stroustrup in 1979 as 'C with Classes'.
- Using an outdated C++ standard flag — always compile with at least `-std=c++17`. The default in older g++ installations is C++98 which lacks auto, move semantics, and smart pointers.
- Mixing C-style code (raw pointers, printf, malloc) into modern C++ — not everything that compiles is good C++. Prefer std::string over char*, cout over printf, and smart pointers over raw new/delete.
- Thinking C++ is 'just C with classes' — C++ has evolved enormously. Modern C++ (C++11+) is almost a different language from C++98.