Discussion in 'General Electronics Chat' started by nikunjpancholi, Oct 20, 2008.
What is the difference between C & C++?
I suggest you do some research for the purpose of answering your own question. Without some background, any answer I give is quite likely to sail right over your head.
Not to be mean, but I honestly cannot understand how someone has the ability to find this forum and ask a question, while not doing a simple search to answer their own question.
Type " What is the difference between C & C++? " in google, there are hundreds of links that talk about this.
Such hassle for such a simple question.
Primarily, they are both virtually identical - C++ however, is a fully object oriented language.
C is capable of using classes also by use of the struct command, but is not completely object oriented.
As the previous people mentioned, any further understanding can really only be understood by studying them both in further detail.
Basically, it boils down to the introduction of the concept of Object Oriented Languages, hence the evolution of C to C++.
Wow, someone's post was actually productive. Thank you
I take issue with this statement. They have some similarity due to a common set of syntactical constructs. In scope and approach to the constuction of algorithms and useful software they are radically different. In particular C++ provides a whole range of constructs, the use of which can lead the novice programmer down the road to perdition. Unless you have substantial justification for using it C++ should be avoided for most applications.
You're simply describing the differences required in converting to an object oriented programming language. You can still code in C with C++, but vice versa doesn't hold true - So why not start off with C++? You're still required to learn all the concepts applied in C with very little extra confusion.
When I stated that they were 'virtually identical' - I was 'tip-toeing' around the concept that I can still code in C using my C++ compiler with little or at least usually, no change.
Besides, C teaches a person really limiting/bad programming habits, and is much harder to modify than C++. Yeah object oriented programming takes longer to type out, but the effort is well worth it - As a programmer, you shouldn't be finding the 'length of code' to be an issue, if it is - You need to type out more code.
Bottom line - C++ is that 'thing' I wrap around my C code. I play in C - But I develop it in C++.
In truth, this is a lie, because I haven't touched C/C++ since college (I was VERY good with it though) - I primarily use Delphi now (and haven't even touched that for a couple of years), but the same concepts still apply as it does with MANY languages - I can go object oriented or not.
Point being, as with any programming project... When it's time for the finished development - It's object oriented if at all possible - Why? Because it's better, it's adaptable, it's easier to design/modify and even more important - Easier to modify/understand by someone else.
Besides, in the end the difference between C and C++ isn't the hard part - Learning the nuances between different languages/distributions like C/Pascal, Visual C++/Delphi and Borland C++/Microsoft C++ is what will have you pulling your hair out...