← Back to C++ Course | Chapter 1: Introduction & Basics | Lesson 2 of 15

C++ History & Features

History of C++

Bjarne Stroustrup began designing C++ in 1979 at Bell Labs, originally calling it 'C with Classes' because his goal was simply to add object-oriented features on top of the existing C language. The name changed to C++ in 1983, using the increment operator as a pun for 'one step beyond C'.

Example: History of C++

cpp
#include <iostream>

int main() {
	// Bjarne Stroustrup began "C with Classes" in 1979 at Bell Labs;
	// renamed C++ in 1983 -- ++ as a pun for "one step beyond C".
	std::cout << "C++ began life in 1979 as 'C with Classes'" << std::endl;
	return 0;
}

Object-Oriented Programming

The biggest feature C++ added over plain C was object-oriented programming: classes let you bundle data and the functions that operate on it into a single reusable unit called an object. This makes large codebases easier to reason about, since related state and behavior live together instead of being scattered across loose functions and structs.

Example: Object-Oriented Programming

cpp
#include <iostream>

class Car {
public:
	int speed = 0;
	void accelerate() { speed += 10; }
};

int main() {
	Car car;
	car.accelerate();
	std::cout << "Speed: " << car.speed << std::endl;
	return 0;
}

Speed and Efficiency

Because C++ compiles straight down to native machine instructions rather than running through an interpreter or virtual machine, there's very little overhead between your code and the CPU actually executing it. That raw speed is exactly why performance-critical engines, including the tooling behind cookiescursor.com, are built in C++ instead of a higher-level language.

Example: Speed and Efficiency

cpp
#include <iostream>

int main() {
	// No interpreter or VM -- compiles straight to native instructions.
	std::cout << "C++ compiles directly to machine code for minimal overhead" << std::endl;
	return 0;
}

Rich Library Support

The Standard Template Library (STL) ships with every standard C++ compiler and gives you ready-made, well-tested data structures like vector, list, and stack along with algorithms to search and sort them. Using the STL instead of writing your own linked list or sort function saves time and avoids a whole class of manual-memory bugs.

Example: Rich Library Support

cpp
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
	std::vector<int> nums = {5, 2, 8, 1};
	std::sort(nums.begin(), nums.end());
	std::cout << "Sorted first element: " << nums[0] << std::endl;
	return 0;
}

Extensibility

C++ has kept evolving through numbered standards like C++11, C++14, C++17, and C++20, each adding modern conveniences such as lambda expressions, smart pointers, and structured bindings. This means code written today can be noticeably shorter and safer than the same logic written in older C++ style, while still compiling to the same fast machine code.

Example: Extensibility

cpp
#include <iostream>

int main() {
	// C++11 lambda expression -- a modern convenience added by later standards
	auto square = [](int x) { return x * x; };
	std::cout << "Square: " << square(5) << std::endl;
	return 0;
}

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.