Introduction to C++
C++ is a compiled, statically typed systems programming language with no garbage collector. Its guiding philosophy is 'zero-cost abstractions': the high-level features you use — classes, templates, exceptions — are designed to cost nothing at runtime beyond what the equivalent hand-written low-level code would cost.
Unlike Rust, which enforces memory safety at compile time through a borrow checker, C++ gives you the raw mechanism — pointers, manual allocation — and relies on conventions like RAII (covered later in this course) to manage resources safely. That tradeoff is central to understanding C++: it trusts the programmer with more power and more responsibility.
A quick preview
Here's a real C++ program, executed for real on this page's own compiler — not a mockup:
#include <iostream>
using namespace std;
int main() {
string message = "Hello from C++!";
cout << message << endl;
return 0;
}Hello from C++!
That's it — a string variable, printed with cout. The next lesson runs your first full program and explains exactly what's happening.
Practice exercise
Declare a variable named version with type int set to 17, then print "C++ version: " followed by version using cout.