Possible Duplicate:
“C subset of C++” -> Where not ? examples ?
I'm aware that C++ is not a strict superset of C. What language features prevent C++ from being a superset of C?
C++ is a superset of C. All your C programs will work without any modification in this environment. However, we recommend that you get accustomed to new styles and techniques of C++ from day one.
Objective-C is a thin layer atop C and is a "strict superset" of C, meaning that it is possible to compile any C program with an Objective-C compiler and to freely include C language code within an Objective-C class. Objective-C derives its object syntax from Smalltalk.
"Objective-C is a superset of C" means that every valid C program is a valid Objective-C program (with the same meaning).
C++ language is a subset of the C language. C++ was first designed as an extension of C language. Thus in addition to the procedural language features derived from C, C++ also supports object-oriented programming features like inheritance, polymorphism, abstraction, encapsulation, etc.
The elephant in the room: the following is valid C but not valid C++.
int typename = 1;
Substitute your favorite C++ reserved word.
C++ also does not support variable-length arrays, where:
int array[n];
is valid in C, but not C++. A C++ version of the above would be:
int *array = new int[n]; ... delete [] array;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With