How Simula Shaped C++ Class Design

When Bjarne Stroustrup created C++ in the early 1980s, his primary objective was to combine the computational speed and hardware control of C with the sophisticated organization of Simula. Simula 67, widely recognized as the first object-oriented programming language, provided the foundational blueprint for C++'s class mechanics, including the concept of classes as user-defined types, hierarchical inheritance, and runtime polymorphism. This article explores how Simula’s core concepts directly influenced the syntax, architecture, and behavior of class design in C++.

The Origin: Stroustrup’s Cambridge Experience

During his doctoral research at Cambridge University, Bjarne Stroustrup used Simula to model distributed systems. While he admired the way Simula used classes to map software models directly to real-world problems, he found the language's runtime performance inadequate for systems-level development. Conversely, low-level languages like BCPL and C offered optimal speed but lacked modularity.

When Stroustrup began work at Bell Labs on distributed network systems, he aimed to build a tool that bridged this gap. The result was "C with Classes" (later renamed C++), a language that preserved C’s low-overhead execution while adopting Simula's structural abstractions.

The Introduction of the Class Concept

Simula 67 introduced the idea that a class is an encapsulation mechanism combining state (variables) and behavior (functions/procedures) into a distinct user-defined type.

Prior to C++, the C language relied on struct merely as a passive grouping of memory. C++ adopted Simula's class keyword and semantics, allowing developers to define types that:

  • Bind data and the operations that mutate that data together.
  • Instantiate distinct objects with their own independent state.
  • Enforce interface boundaries through access controls.

Stroustrup unified this with C’s type system, ensuring that a class had the exact same runtime efficiency as a standard C struct.

Inheritance and Subtyping

Simula handled hierarchies through a process called "class prefixing." A class could be prefixed by the name of another class, thereby inheriting all attributes and behaviors of the base class.

C++ transformed Simula's class prefixing into modern class inheritance. This gave developers the ability to:

  • Establish "is-a" relationships between derived and base classes.
  • Reuse code without copying boilerplate logic.
  • Organize types into structured taxonomies.

While C++ later expanded on this with access specifiers (public, protected, private) and multiple inheritance, the underlying conceptual model was derived from Simula’s approach to hierarchical specialization.

Virtual Functions and Dynamic Polymorphism

Simula introduced virtual procedures, enabling late binding where an operation's execution is determined at runtime based on the actual type of the object, not the type of the reference holding it.

Stroustrup adopted the virtual keyword directly from Simula. To implement it without introducing significant runtime overhead, C++ utilized the virtual method table (vtable). This mechanism allowed C++ to retain Simula's flexible polymorphism while meeting the strict microsecond-level performance demands of systems software.

Adapting Simula for Systems Programming

While Simula heavily inspired the structure of C++ classes, Stroustrup intentionally modified several aspects to ensure systems-level viability:

  • Memory Management: Simula relied on an automatic garbage collector, which introduced latency and unpredictable performance. C++ discarded automatic garbage collection in favor of explicit object lifecycles, leading to the creation of constructors and destructors (which form the foundation of RAII—Resource Acquisition Is Initialization).
  • Stack Allocation: In Simula, objects were dynamically allocated on the heap as reference types. C++ allowed classes to be instantiated directly on the stack or embedded within other structures, eliminating heap allocation overhead.

Simula provided the architectural theory of classes, while C provided the pragmatic execution model. By adapting Simula's classes, inheritance, and virtual procedures into the syntax and memory architecture of C, Stroustrup established the object-oriented foundation that defined C++ and influenced modern software engineering.