
Posted by hema on January 24, 204 at 04:16:57:
In Reply to: C is a subset of C++ posted by Lourdes Hernandez on December 08, 1999 at 11:59:53:
: C is a subset of C++
: In the 1980s Bjarne Stroustrup, a computer scientist,
: took the "C" language and added features of another older
: language, Simula 67, to help him create a language that would
: allow him to easily simulate things he was working on. It was
: called "C++," which is an incremental advance over "C."
: Hence the name, "C++."
: C is a computer language defined by ISO and ANSI, the
: international and American standards bodies. You will
: most often hear references to ANSI C, since the ANSI
: committee first standardized C and the ISO committee
: basically kept the same standard intact. It was originally
: designed for systems programming because it allows programmer
: to write efficient code. C compilers are found on just about
: every Unix system and are now available with most operating
: systems.
: C++ is a language that grew out of C. It began as a
: version of C with extensions for object-oriented programming
: (OOP) and grew into its own language. C++ is basically an
: extension of C's abilities. C++ supports every desirable
: behavior and most of the undesirable ones of C too.
: The only difference is that C++ provides general language
: improvements and Object Oriented functionality. C++ is a
: subset of C because it has many of the same features such
: as efficiency, closeness to the machine and a variety of
: built-in types. This allows experienced C programmers to
: make the smooth transition to C++ without having to learn
: an entirely new language.
: A few examples of the way C++ is an improvement of C are:
: · Comment lines in C use "/* */", while in C++ you
: could just use "//" per line plus it uses C's "/ **/".
: · In C, constants are specified using #define while
: C++ allows any variable to be declared a constant by
: using "const" and uses #define.
: · C++ also allows the program to use the "Swap"
: function, statements can be placed anywhere in the program.
: · C++ is able to overload functions and operators
: All in all, the many new features of C++ proves that it
: is a better version of C. C++ has a stronger type
: checking by checking arguments to functions and reduces
: syntactic errors by reference types. It also allows the
: programmer to create their own classes. If a compiler
: does not say it can compile ANSI C, most C programs are
: valid C++ programs and you can probably use it anyway.
: There are some cases where valid C programs are not valid
: C++ programs, but these are rare.