C++ History & Features
In this page:
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++
#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;
}
Login to try C/C++/Java/PHP code in the editor
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
#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;
}
Login to try C/C++/Java/PHP code in the editor
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
#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;
}
Login to try C/C++/Java/PHP code in the editor
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
#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;
}
Login to try C/C++/Java/PHP code in the editor
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
#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 try C/C++/Java/PHP code in the editor
Chapter Quiz — Complete all 15 topics to unlock
0/15 topics done
Complete these topics first: