C++ Mastery Complete Guide for Interviews
A complete reference of everything we have covered in our deep-dive series — structured for
revision, interview prep, and mastery.
1. Core C++ Concepts
- Value types vs Reference types
- Lvalues, Rvalues, Lvalue references, Rvalue references
- const, constexpr — deep dive
- static keyword
- Copy elision, Return Value Optimization (RVO)
- Memory layout of objects
- Stack vs Heap
- Lifetime of objects
2. Object-Oriented Programming (OOP)
- Classes vs Structs
- Constructors (default, parameterized, copy, move)
- Destructors (regular, virtual, order of calls)
- Member initializer list
- Inheritance (single, multiple, virtual)
- Diamond problem and virtual inheritance
- Constructor call order in inheritance hierarchy
- Object slicing
- Friend functions and friend classes
3. Polymorphism
- Compile-time: Function overloading, operator overloading
- Runtime: Virtual functions, pure virtual functions
- Virtual tables (vtables), vptr
- Virtual destructors
- Abstract base classes
- Upcasting vs Downcasting
- static_cast, dynamic_cast, reinterpret_cast, const_cast
4. Memory Management
- Manual memory allocation (new, delete, new[], delete[])
- Smart pointers: unique_ptr, shared_ptr, weak_ptr
- Custom smart pointer implementation
- Rule of 3, Rule of 5, Rule of 0
- RAII (Resource Acquisition Is Initialization)
- Struct padding, alignment, packing
5. Templates & Metaprogramming
- Function templates
- Class templates
- Template specialization
- SFINAE basics
- constexpr with templates
- Perfect forwarding
- Type deduction rules
- Variadic templates
6. STL and Iterators
- Iterators (regular, const, reverse, custom)
- STL containers and usage patterns
- STL algorithms (std::sort, std::accumulate, etc.)
- std::string and string manipulation
7. Threads & Concurrency
- std::thread
- Joining and detaching
- Thread safety, mutexes
- Race conditions
- Thread pools (intro)
8. Functions and Function-Like Constructs
- Lambda expressions (with and without capture)
- Inline functions vs macros
- Function pointers
- std::function, std::bind
9. Design Practices
- RAII
- Rule of 0/3/5
- SOLID principles (high level)
- Avoiding 'using namespace std;'
- explicit keyword for constructors
- enum class
- Forward declarations vs includes
- Zero-cost abstractions
- Prefer STL + idiomatic C++
- Minimize interdependencies
- Avoid raw new/delete
10. Tricky Interview Questions We Explored
- C-style cast quirks
- Lvalue/rvalue traps
- Diamond inheritance behavior
- Object slicing
- Cast from derived to base and vice versa
- Virtual destructor edge cases
- Smart pointer traps
- Struct alignment with #pragma pack
- References to temporaries
- Perfect forwarding pitfalls