How this C++ track works
- g++ in the playground — write a single
main.cppwithint main(); the dev runner compiles withg++ -std=c++17 -Walland runs the binary. - Modern C++ first — lessons favor
std::vector,std::string, references, RAII, andstd::unique_ptrover raw C-style patterns when teaching new concepts. - Prerequisites — finish C (pointers, memory) and JavaScript (functions, variables). Java or Rust help with OOP and type systems.
Multi-file CMake projects, templates in separate headers, and platform APIs run locally—lessons simulate patterns in a single translation unit where the sandbox requires it.
Install on your device (macOS, Linux, Windows)
Install a C/C++ compiler (GCC or Clang) for local projects; playground uses g++/gcc.
macOS
- Install Xcode Command Line Tools:
xcode-select --install clang++ --versionandg++ --version(optional via Homebrewbrew install gcc).
Linux
- Debian/Ubuntu:
sudo apt install -y build-essential gdb - Fedora:
sudo dnf groupinstall -y "Development Tools"
Windows
- Install MSVC Build Tools with “Desktop development with C++”, or MSYS2:
pacman -S mingw-w64-x86_64-gcc.
Verify: c++ --version or g++ --version.
Run code on this site (Backend & language playgrounds)
- Clone or open this project locally; copy
.env.exampleto.env. - Ensure
LEARNING_RUNNER_ENABLED=trueandLEARNING_RUNNER_URL=http://127.0.0.1:9999/v1/execute. - Terminal 1:
php artisan serve(orcomposer run devfor Laravel + Vite + runner together). - Terminal 2:
npm run runner— keep it running while you click Run on server.
C++ extends C with classes, templates, exceptions, and a rich standard library. It compiles to native machine code and powers game engines, browsers, databases, trading systems, and embedded firmware where performance and control matter.
How this track differs from C and JavaScript
After the C track, you know pointers and manual memory. C++ adds RAII, constructors, templates, and the STL—tools to express abstractions without giving up speed. After JavaScript, expect static types, compile-time checks, and no garbage collector by default (though smart pointers help manage heap objects safely).
Unlike Java, C++ has no JVM—your code runs directly on the CPU. Unlike C alone, you can model domain concepts with classes and reuse algorithms from the standard library.
What you will learn
- Syntax: variables, references, control flow, functions, and namespaces
- OOP: classes, inheritance, polymorphism, access control, operator overloading
- Memory and STL: pointers, new/delete, vectors, strings, maps, iterators
- Modern C++: smart pointers, move semantics, lambdas, templates, exceptions
- Systems: headers, compilation, const/constexpr, algorithms, file I/O, debugging
Playground setup
This topic uses the server_compiled profile: your code compiles with g++ -std=c++17 -Wall as a single main.cpp file. Use int main() and std::cout for output.
Important interview questions and answers
- Q: Why learn C++ after C?
A: C++ builds on C ABI compatibility while adding zero-cost abstractions—understanding both helps you read legacy and modern codebases. - Q: Is C++ garbage collected?
A: No by default—use stack objects, RAII, and smart pointers; avoid raw new/delete in application code when possible.
Self-check
- In one sentence, what does RAII mean?
- Why do we recommend finishing the C track first?
Tip: Finish the C track first—C++ builds on pointer and memory concepts from C.
Interview prep
- What is C++ in one sentence?
A statically typed multi-paradigm language that compiles to native code, extending C with OOP, templates, exceptions, and the STL.
- Why learn C++ after C?
C++ builds on C memory and ABI concepts while adding RAII, abstractions, and standard containers—essential for reading modern native codebases.