Basics for C++s
C++ basics are the core language building blocks: fundamental types, variables, operators, control flow with if, switch and loops, then functions and classes with constructors, member functions and access control. This unit is the starting point of the roadmap and gives the vocabulary for the more advanced memory and template topics.
Stage: Language Core · Part of the C++ roadmap · Last reviewed 19 November 2026
What to learn in Basics
- Declare variables with auto and fundamental types and know their sizes
- Write loops and branches including range-based for
- Pass arguments by value, reference and const reference
- Define a class with a constructor, members and private data
- Compile and run a program from the command line with g++ or clang++
Basics interview questions
What is the difference between passing by value and by reference in C++?
Passing by value copies the argument, so changes do not affect the caller. Passing by reference gives the function an alias to the original object, so changes are visible. A const reference avoids a copy while preventing modification.
What does the const keyword do on a member function?
A const member function promises not to modify the object's non-mutable members, so it can be called on const objects. The compiler enforces this, which documents intent and enables safer use through const references.
Where Basics fits in the C++ roadmap
Basics belongs to the Language Core stage (intermediate level), which takes about 37 hours. C++ essentials.