Skip to content
Learn Netverks

Lesson

Step 1/36 3% through track

intro

Introduction to C++

Last reviewed May 28, 2026 Content v20260528
Track mode
server_compiled
Means
Compiled runner
Reading
~3 min
Level
beginner

This lesson

An orientation to the C++ track—how the compiled playground works, core vocabulary, and what you will practice next.

You need a clear map of the C++ track so classes, RAII, templates, and the STL do not feel like magic.

You will apply Introduction to C++ in contexts like: Game engines, trading systems, desktop apps, and performance-critical libraries.

Write C++ in main.cpp with int main(), click Run on server—the dev runner compiles with c++/g++ -std=c++17 -Wall and runs the binary; read template errors in stderr (LEARNING_RUNNER_ENABLED=true). Also read the interview prep blocks.

After the C track or equivalent—C++ builds on C memory ideas and adds OOP, templates, and the STL.

How this C++ track works

  • g++ in the playground — write a single main.cpp with int main(); the dev runner compiles with g++ -std=c++17 -Wall and runs the binary.
  • Modern C++ first — lessons favor std::vector, std::string, references, RAII, and std::unique_ptr over 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

  1. Install Xcode Command Line Tools: xcode-select --install
  2. clang++ --version and g++ --version (optional via Homebrew brew install gcc).

Linux

  1. Debian/Ubuntu: sudo apt install -y build-essential gdb
  2. Fedora: sudo dnf groupinstall -y "Development Tools"

Windows

  1. 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)

  1. Clone or open this project locally; copy .env.example to .env.
  2. Ensure LEARNING_RUNNER_ENABLED=true and LEARNING_RUNNER_URL=http://127.0.0.1:9999/v1/execute.
  3. Terminal 1: php artisan serve (or composer run dev for Laravel + Vite + runner together).
  4. 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

  1. 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.
  2. 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

  1. In one sentence, what does RAII mean?
  2. 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.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Why C++ after C?
  • First native project idea?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump