ArticleslgStudy

computer science

C with Classes

C with Classes is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand C with Classes rather than just read about it. In short: 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.

C with Classes — main illustration
C with Classes — illustration

Key takeaways

  • C with Classes belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect C with Classes to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of C with Classes from memory before moving on to harder problems.

Reference excerpt

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.

History

In 1979, Bjarne Stroustrup began work on C with Classes. 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. 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. Initially, Stroustrup's "C with Classes" added features to the C compiler, Cpre, including classes, derived classes, strong typing, inlining, and default arguments. In 1982, Stroustrup began designing a cleaned-up and extended successor to C with Classes, using traditional compiler technology. 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. 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. Stroustrup also designed and implemented Cfront, the C++ compiler front end, between spring 1982 and summer 1983.

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. 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. 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.

C with Classes did not have virtual functions or function and operator overloading; these were not added until C++ in 1984. 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.

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. task was a class with a private constructor, for types to inherit from (and should not be confused for std::execution::task<T, Env>, added in C++26), used to represent an independent activity (a coroutine, or lightweight thread). Inter-task communication was done through queue classes, with a producer task putting data into qhead and a consumer task pulling it out from qhead. Classes timer and clock were part of a time framework used for Simula-style event-driven simulations.

See also Cfront C++

References

External links C++ History Collection – a collection of design documents for historical C with Classes and C++

Illustrations

C with Classes illustration
C with Classes illustration
C with Classes: Bjarne Stroustrup, the creator of C++, in his AT&T New Jersey office, c. 2000
Bjarne Stroustrup, the creator of C++, in his AT&T New Jersey office, c. 2000

Worked examples

Example 1 — a first encounter with C with Classes

Start with the simplest possible case. Write down what C with Classes claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to C with Classes before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about C with Classes ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of C with Classes

In research
C with Classes appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses C with Classes in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
C with Classes is common in secondary-school and first-year university syllabi. It links to neighbouring topics Algol programming language family, C++, C++ programming language family, so understanding it makes those chapters shorter.
In everyday life
Look for C with Classes outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “C with Classes” →

How to study C with Classes in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what C with Classes means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain C with Classes out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is C with Classes in simple terms?

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.

Why does C with Classes matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study C with Classes?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on C with Classes.

Tags

  • Algol programming language family
  • C++
  • C++ programming language family
  • Class-based programming languages
  • Compiled programming languages
  • Cross-platform software
  • High-level programming languages
  • Object-oriented programming languages
  • Statically typed programming languages

Keep exploring