Britannica Sources used in this answer

How does C++ add object-oriented features to the C programming language?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

C++ enhances the traditional C programming language by integrating object-oriented programming features while maintaining the high execution speed and low-level hardware access prized by C developers.12

Developed by Bjarne Stroustrup, the language was originally titled "C with Classes" to highlight its modular organization. Key additions that facilitate object-oriented design include:1

  • Classes: These allow for the modular organization of code, enabling programmers to define objects that encapsulate data and behavior.1
  • Virtual Functions: Introduced to support polymorphism, these allow for dynamic method resolution.1
  • Inheritance: Later versions added support for multiple inheritance, allowing classes to derive characteristics from more than one parent class.1
  • Operator Overloading: Borrowed from ALGOL 68, this feature allows developers to redefine how operators function with user-defined types.1

By incorporating these abstractions from the language Simula 67 into the efficient framework of C, Stroustrup created a language capable of handling large-scale software development without sacrificing performance.12