Hi,
I have heard that C++ is almost a superset of C. Can anyone please tell me what can one do in C which we can't in C++
Thanks
Hi,
I have heard that C++ is almost a superset of C. Can anyone please tell me what can one do in C which we can't in C++
Thanks
some entropy with that sink? entropysink.com
there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka
C++ is an object oriented programming language. Usually programs in c++ can be more organized as far as structure. Some will claim that C is actually faster because its a "lower-level" language. I cant state if one is faster or not, I honestly dont know. And C++ really is C. Anything that is C is C++.. C++ just has extended features. But I like to look at them as two separate laguages. I usually dont like to mix the two but thats just me.
What is C++?
forgot both C and C++. Go for basic it does even more than either!!!!!!!
Woop?
forget about c.. c++.. java.. basic... grow some kahoonas and code completely in machine language.
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
Not really, but it sure tries to be. It isn't an "entirely OO" language. That is to say you can code to your hearts content in C++ without ever using any OO behaviour or style at all. Thus, it isn't a true OO language. It wants to be though.Originally Posted by Vicious
Quzah.
Hope is the first step on the road to disappointment.
Yeah C++ I shouldnt have said it was an OO language, yet should have said it has OO "features". Unless I'm mistaken ( correct me if I'm wrong ) C# is purely OO.Originally Posted by quzah
[note] If I'm not mistaken, in C++'s early years it was refered to as C with classes.
Last edited by Vicious; 09-19-2004 at 10:56 PM.
What is C++?
C++ is an object-oriented language. It facilitates all of the main principles of object orientation( data abstraction, inheritance, polymorphism, etc. ), and it allows for you to express your program in terms of objects instead of modules or functions. It is not a pure object oriented language like Java, Smalltalk, or Eiffel which force you to express your program entirely with objects. The great thing about C++ is that it supports all of the major programming paradigms and styles, but it does not force any one of them, allowing the programmer to express their program with the paradigm they deem most fit. C++ brings a lot more to the table than just object orientation, and I find it hard to refer to C++ as a mere superset of C, though I suppose it technically is. There's nothing that can be done with C that can't be done with C++.
So you can have variable length arrays in C++?There's nothing that can be done with C that can't be done with C++.
You can not cast void * when assigning to another pointer in C++?
There are things that C++ can not do that C can do. Most of it is pretty minor and trival but they do exist.
Last edited by Thantos; 09-20-2004 at 07:02 AM.
>>You can not cast void * when assigning to another pointer in C++?
Isn't void* practically the same as unsigned char* (or char*), other than the fact that you can't dereference it?
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.
>So you can have variable length arrays in C++?
You'd have to allocate them dynamically but yes. Or in cases where appropriate, you could use a vector
>You can not cast void * when assigning to another pointer in C++?
You'll almost never need to use void pointers in C++(as my highly criticized sig would indicate)
There's a C way to do things and there's a C++ way to do things. If you use C-inspired code with C++, you might run into some slight pitfalls here and there, but the general idea is that C++ can do anything that C can.
If you're programming on microcontrollers and the like, you are more likely to be using C than C++ (as it is, I believe, considered too bloated for such applications), but perhaps someone with more experience with this can elaborate.
C++ and C are not entirely compatible, but largely are. Most C code that I have run into in general applications would be perfectly legal (or very close) in C++.
Not on all machines. On some machines the sizeof (void *) is different then sizeof(char *)Originally Posted by Hunter2
Even so there are some things that C can do that C++ can not even if there is a way to simulate them.There's a C way to do things and there's a C++ way to do things.
Lower-level != faster in all cases.Some will claim that C is actually faster because its a "lower-level" language
When I was doing a report on Pascal vs C I wrote some basic test programs and the pascal program ran faster then the C program.
I know, I wish some one ( with more know-how than myself ) would do a few tests with C and C++ to see if one is infact faster than another. And if there is enough difference to actually affect preformance.Lower-level != faster in all cases.
When I was doing a report on Pascal vs C I wrote some basic test programs and the pascal program ran faster then the C program.
What is C++?
??I always thought that Object Oriented Programming was a style of programming? You can use any language as far as i know even assembly language to program in OOP. As long as you adhere to its principles.
"Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
-- Cowper
Operating Systems=Slackware Linux 9.1,Windows 98/Xp
Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)
You may teach a person from now until doom's day, but that person will only know what he learns himself.
Now I know what doesn't work.
A problem is understood by solving it, not by pondering it.
For a bit of humor check out xkcd web comic http://xkcd.com/235/