English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Answer just briefly and in simple terms

2006-11-24 01:12:02 · 5 answers · asked by afiasan 3 in Computers & Internet Programming & Design

5 answers

Briefly, it is about the same kind of difference as between chinese and korean...
Both use letters, and are understood by computers. But the syntax, lexic and vocabularies are different.
Helps?

BTW, one being "oops", and the other one not is really bull... Create a struct in "C", shove some pointers to functions into it, and enjoy your very own "object".
Now, create another struct, with the previous one as the first field - and you have just discovered inheritance. Cast a pointer to the second one into a pointer to the first - and that is your polymorphism.

Another myth is that C++ is a "superset of C" or that you can compile a C program with a C++ compiler, or that C is "C++ without classes". This is not true. They look somewhat similar to a human eye, but formally are totally different laguages.
You could, probably, come up with some fairly simple C program, that can be compiled with C++, just like some Spanish words (and even sentenses) are also valid in French, but in general that is not true.
Function pointers are not compatible with void*, or with each other. Integers are not compatible with pointers, and are not assumed by default, you can't skip a type declaration etc, etc.

And finally, no, "C" is not faster than "C++" on any sane system.

2006-11-24 01:21:30 · answer #1 · answered by n0body 4 · 1 1

C++ has classes (even if it's not exactly an object-oriented language, it's a general-purpose language allowing object-oriented programming). C++ has generic programming (templates). C++ has namespaces. C++ has a different way of managing I/O (cin, cout etc.).

It's 99% true that C is a subset of C++, which means that a C program is USUALLY also a C++ program. C++ has important extra features that make it a new language; indeed, a good C++ program is very different from a C program. Nevertheless, many programmers just use a few of the new features of C++.

The best thing to do to understand C++ is reading what its father wrote about it. His name is Bjarne Stroustrup and his homepage is http://www.research.att.com/~bs/homepage.html

2006-11-24 01:26:20 · answer #2 · answered by maurovanetti 1 · 1 2

In very simple terms, C++ is object-oriented C. In other words, C is C++ without classes.

Rawlyn.

2006-11-24 01:17:02 · answer #3 · answered by Anonymous · 0 2

The main difference is the class concept... who revolutionized the oop programming... of course there are lots of other new concepts but this (and what cames with it) is the most important one...

2006-11-24 02:33:16 · answer #4 · answered by None A 3 · 0 2

the ++

2006-11-24 01:20:00 · answer #5 · answered by PHIL M 4 · 0 1

fedest.com, questions and answers