| C++ language revisions |
|---|
| This article is part of a series on the C++ programming language |
C with Classes was the historical precursor language to what would later become C++, both of which were first created by Danish computer scientist Bjarne Stroustrup. As its name suggests, it aimed to extend the C language with object-oriented features, namely classes.
The term "C with classes" has also been used colloquially (sometimes disparagingly) to refer to C++ code written as if it were C.[2]
History

In 1979, Bjarne Stroustrup began work on C with Classes.[3] The motivation for creating a new language originated from Stroustrup's experience in programming for his PhD thesis. Stroustrup found that Simula had features that were very helpful for large software development, but the language was too slow for practical use, while BCPL was fast but too low-level to be suitable for large software development. When Stroustrup started working in AT&T Bell Labs, he had the problem of analyzing the UNIX kernel with respect to distributed computing. Remembering his PhD experience, Stroustrup set out to enhance the C language with Simula-like features.[4] C was chosen because it was general-purpose, fast, portable, and widely used. In addition to C and Simula's influences, other languages influenced this new language, including ALGOL 68, Ada, CLU, and ML.[5]
Initially, Stroustrup's "C with Classes" added features to the C compiler, Cpre, including classes, derived classes, strong typing, inlining, and default arguments.[6]
In 1982, Stroustrup began designing a cleaned-up and extended successor to C with Classes, using traditional compiler technology.[7] The language was briefly called C84 before the name C++ was adopted; the name was suggested by Rick Mascitti and refers to C's ++ increment operator.[7][8] The resulting language included virtual functions, function and operator overloading, references, const, improved type checking, user-controlled free-store memory allocation (new/delete), and BCPL-style single-line // comments.[7] Stroustrup also designed and implemented Cfront, the C++ compiler front end, between spring 1982 and summer 1983.[7]
Language
The language's constructors and destructors, rather than using the class names (X() and ~X()), used the new and delete keywords themselves as methods returning void; these keywords served to replace the C memory allocation functions malloc() and free(). C with Classes lacked the private keyword, and had only a public keyword to declare a public region of the class, while everything before was private.[9]
C with Classes, which lacked namespaces, did not use the namespace resolution operator :: for referring to class members; rather, it used the period ., much like C. Providing the definition of a class method inside the class itself inlined the function, avoiding the function call overhead.[10] In early iterations of C with Classes, every class would also have void call() and void return() (implicitly defined if not explicitly written) methods which would be called before and after (respectively) every function call.[10]
#define STACK_SIZE 128
#include <stream.h>
class Stack {
char* min;
char* top;
char* max;
/* Constructor, with default parameter */
void new(int size = STACK_SIZE) {
top = min = new char[size];
max = min + size - 1;
}
/* Destructor */
void delete(void) {
delete min;
}
public:
void push(char c);
char pop(void);
};
/* Notice it is Stack.push(), not Stack::push() */
void Stack.push(char c) {
if (max <= top) {
error("Stack overflow");
}
*top++ = c;
}
char Stack.pop() {
if (top <= min) {
error("Stack underflow");
}
return *(--top);
}
main() {
/* Much like C, the class keyword must appear before its name */
class Stack s;
int i;
for (i = 0; i < 10; ++i) {
s.push((char)('a' + i));
}
for (i = 0; i < 10; ++i) {
cout << s.pop() << '\n';
}
}
C with Classes did not have virtual functions or function and operator overloading; these were not added until C++ in 1984.[10]
Templates did not appear until Cfront 3.0 in 1991, and namespaces not until 1993; exceptions were first conceived for C++ around 1990 but only implemented in 1992.[10]
Library additions
Stroustrup wrote various library headers for C with Classes; the most notable of these were a task library (<task.h>) for Simula-style concurrency, as well as a stream-based I/O library (<stream.h>, which would later become the foundation for the <iostream> header.[7]
See also
References
- ↑ Prinz, Peter; Crawford, Tony (16 December 2005). C in a Nutshell. O'Reilly Media, Inc. p. 3. ISBN 978-0-596-55071-4.
- ↑ Joseph, Lentin (2018). Fundamentals of C++ for Robotics Programming. Berkeley, CA: Apress. ISBN 978-1-4842-3404-4.
- ↑ Stroustrup, Bjarne (7 March 2010). "Bjarne Stroustrup's FAQ: When was C++ invented?". stroustrup.com. Archived from the original on 6 February 2016. Retrieved 16 September 2010.
- ↑ Stroustrup, Bjarne. "Evolving a language in and for the real world: C++ 1991-2006" (PDF). Archived (PDF) from the original on 20 November 2007. Retrieved 14 August 2013.
- ↑ The C Family of Languages: Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling, C++ Report, 12(7), July/August 2000, cited in "The C Family of Languages: Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling". Retrieved 26 December 2025.
- ↑ Stroustrup, Bjarne. "A History of C ++ : 1979− 1991" (PDF). Archived (PDF) from the original on 2 February 2019. Retrieved 18 July 2013.
- 1 2 3 4 5 Stroustrup, Bjarne (March 1993). A History of C++: 1979–1991 (PDF). The Second ACM SIGPLAN Conference on History of Programming Languages. Association for Computing Machinery. pp. 271–297. doi:10.1145/154766.155375. Retrieved 9 June 2026.
- ↑ Malloy, Rich (August 1988). "The Origin of C++" (PDF). BYTE. p. 216. Retrieved 9 June 2026.
- ↑ Bjarne Stroustrup (14 August 1981). "Classes: An Abstract Data Type Facility for the C Language" (PDF). softwarepreservation.computerhistory.org. Bell Laboratories.
- 1 2 3 4 Olve Maudal (17 June 2015). "History and Spirit of C and C++" (PDF). pvv.ntnu.no. Norwegian University of Science and Technology.}
External links
- C++ History Collection – a collection of design documents for historical C with Classes and C++
