C++ is better C , it supports data encapsulation , inheritance , generic programming ,etc .
ithelp
Nearly a Posting Maven
2,230 posts since May 2006
Reputation Points: 769
Solved Threads: 128
Hello,
I am little bit confuse for c and c++. All loops are same in both the languages so why they are different for each other?
you will find the same similarities in most computer languages and that makes it easy to learn several different languages.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
You should rather refer to some good book inorder to remove the elementary confusions.
C++ is an object-oriented version of C.
You can also call it as an enhanced version of C (just in regard to syntax and keywords) .
However, as far as coding style matters, only certain syntactic similarities remain - such as loops. Otherwise, C++ possesses a whole new concept of data encapsulation, inheritance, generic programming, etc., which C certainly doesnt provide.
bhoot_jb
Junior Poster in Training
89 posts since Mar 2008
Reputation Points: 57
Solved Threads: 2
>All loops are same in both the languages so why they are different for each other?
Why is Perl different from C++? They both have a for loop with the same syntax.
1) Comparing the syntax of a single feature isn't a good way to compare languages.
2) C++ is designed to have a subset that's interchangeable with C. To a large extent, that design goal has been successful, which is why the loops in both languages are virtually identical in syntax and semantics.
>C++ is the object-oriented version of C.
That's a rather naive perspective. C++ is multi-paradigm, meaning it isn't just object oriented, or generic, or procedural, it's all of them, depending on your tastes and needs.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
> C++ is a OO oriented version of C.
>> That's a rather naive perspective. C++ is multi-paradigm, meaning it isn't just object oriented, or generic, or procedural, it's all of them, depending on your tastes and needs.
You are right. I just meant to emphasize on the prime and major use of C++, which i think is OO and generic programing.
bhoot_jb
Junior Poster in Training
89 posts since Mar 2008
Reputation Points: 57
Solved Threads: 2
>which i think is OO and generic programing.
Bolded for emphasis. Too often people state an opinion and word it as if it were a fact. Sometimes it's intentional, sometimes not, but it's nearly always misleading.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>it says you have to make it so simple that a four year old can understand
That's probably exaggeration, but I would say that C++ is based on C with lots of extra stuff and a few changes.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401