Questions

C++ questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Advantages of Brace Initialization in C++

Learn why C++ brace initialization is often clearer and safer than other object initialization styles, with examples and common pitfalls.

cppc++11syntaxinitialization

Basic Rules and Idioms for Operator Overloading in C++

Learn the core rules, syntax, and common idioms for operator overloading in C++, including member vs non-member operators.

cppoperatorsoperator-overloadingc++-faq

C++ Aggregates, Trivial Types, Trivially Copyable Types, and PODs Explained

Learn what aggregates, trivial types, trivially copyable types, and PODs mean in C++, how they differ, and why they matter.

cppc++11aggregatec++17

C++ Base Class Constructor Rules Explained

Learn how C++ base class constructors are called from derived classes, including order, syntax, defaults, and common mistakes.

cppinheritanceconstructor

C++ Casts Explained: C-Style Cast vs static_cast vs dynamic_cast

Learn the difference between C-style casts, static_cast, and dynamic_cast in C++ with clear examples, safety rules, and real usage tips.

cpppointerscasting

C++ Compilation and Linking Process Explained

Learn how C++ source files become executables through preprocessing, compilation, assembly, linking, translation units, libraries, and symbols.

cpplinkerc++-faq

C++ Const Member Functions: Meaning and Usage

Learn what const after a C++ member function means, how it protects object state, and when to use const member functions correctly.

cppconstantsfunction-qualifier

C++ File Extensions Explained: .cc vs .cpp on Linux

Learn the difference between .cc and .cpp in C++, when to use each, and how teams choose file extensions on Linux projects.

cppfilenames

C++ Functors Explained: What They Are and When to Use Them

Learn what C++ functors are, how operator() works, and when function objects are useful in STL algorithms and real codebases.

cppfunctorfunction-objectfunction-call-operator

C++ Fundamental Type Sizes: What the Standard Guarantees About int, long, char, float, and double

Learn what the C++ standard guarantees about fundamental type sizes, including int, long, char, float, and double across platforms.

cppintegerlanguage-lawyerlong-integer

C++ Global Scope Resolution Operator (::) Explained

Learn how C++ uses a leading double colon (::) to look up global namespaces and avoid name conflicts in classes and typedefs.

cppnamespacesscope-resolutionglobal-namespace

C++ Header File Extensions: .h vs .hpp Explained

Learn the difference between .h and .hpp in C++, when each is used, and how teams choose a header naming convention in real codebases.

cppheadernaming-conventionsfile-type

C++ Iterator Invalidation Rules for Standard Containers

Learn C++ iterator invalidation rules for vector, deque, list, maps, and unordered containers, with safe erase and insertion patterns.

cppiteratorstdc++-faq

C++ Lambda Expressions Explained: What They Are and When to Use Them

Learn what C++ lambda expressions are, why they exist, when to use them, and how they simplify callbacks, algorithms, and local logic.

cpplambdac++11c++-faq

C++ Most Vexing Parse: Why `Foo foo2()` Is Not an Object

Learn why C++ reads `Foo foo2()` as a function declaration, how the most vexing parse works, and safe ways to create default objects.

cpp

C++ Placement New: Uses, Object Lifetimes, and Safe Examples

Learn what C++ placement new does, why allocators and object pools use it, and how to safely construct and destroy objects in existing storage.

cppmemory-managementnew-operatorplacement-new

C++ Template Definitions in .cpp Files: Explicit Instantiation Explained

Learn when C++ template definitions can live in .cpp files, how explicit instantiation works, and how portable it is across compilers.

cpptemplates

C++ Template Parameters: class vs typename

Learn when to use class or typename in C++ template parameters, why they are usually equivalent, and the key dependent-name distinction.

cpptemplates

C++ Value Categories Explained: lvalues, rvalues, xvalues, glvalues, and prvalues

Learn C++ value categories clearly: lvalues, rvalues, xvalues, glvalues, and prvalues, with examples and why C++11 introduced them.

cppc++11expressionc++-faq

C++ const Function Parameters: Effects and Function Signatures

Learn how top-level const on C++ value parameters protects only a local copy, why it is ignored in function signatures, and when const matters.

cppparametersconstantsfunction-declaration

Page 1 of 8 - 158 questions

PreviousNext