C++ is a high-level programming language that is an extension of C language. C++ supports both procedural programming, characteristic of C language, and object-oriented programming, characterized by abstract data types. It also supports object-oriented programming features like inheritance and polymorphism. C++ excels in object-oriented programming while still allowing for procedural programming.
Features:
Compatibility with C language:
C++ is fully compatible with C language; most of the content in C language can be directly used in C++ programming. Programs written in C language can be used in C++ without modification.
Data Encapsulation and Data Hiding:
In C++, classes are the tools that support data encapsulation, while objects are the implementation of data encapsulation. C++ supports data encapsulation and data hiding through user-defined classes.
Support for Inheritance and Reusability:
New types can be declared based on existing classes in C++, which is the idea of inheritance and reusability. Inheritance and reusability allow for more effective organization of program structure, clarification of relationships between classes, and full utilization of existing classes to achieve more complex and in-depth development.
Polymorphism:
Polymorphism specifies behavior for each class. Polymorphism forms a tree structure composed of parent classes and their subclasses. Each subclass in this tree can receive one or more messages with the same name.