+ 1
What is the difference between C and C++? and it is important to begin with C to learn C++ or not?
3 Answers
+ 3
@neicore: There are a few points here to take into account and maybe update your post on...
Namespace feature is not available through the syntax "namespace" or "using" in C, but the feature of namespaces themselves are available in C (eg: hierarchy_var) as well as most of our lives including our shopping list. Perhaps a better way to say it is C++ provides tools for encapsulation.
C++ is not technically an OO language like. It can be used procedurally (among others like functionally if you're a masochist). C++ is a multi-paradigm language, one of the very few, and fastest of them all.
I won't go into "OO" in C because pointer hackery becomes messy and I don't know if it really qualifies based on the question. But C can provide crude OO capabilities. However, this is *not* C's intended paradigm, just a feature to be used sparingly.
@Yahia Osama: I recommend learning C first because it's a basic, small, powerful language. It gives you good foundations in programming. Next, do a few Java lessons, just a few, to give you an idea of *pure OOP* before learning C++ if you still want to. The reason I suggest a little Java is I learned C waaay back and was put off C++ because it seamed obfuscated syntactically where C seemed straightforward. A friend lent me a Java book by Eckels (???) and I eventually gave it a shot to stop him nagging me. Well the 10% odd I read actually inspired me to take an interest in C++ because the primary aspect, which is OO, suddenly seemed more practical.
I'll always love C, but I've gained a great respect for C++ and I think having that grounding in C and a taste of Java really
made me start to appreciate C++ in a way I probably never would otherwise.
- 1
https://code.sololearn.com/W7X805sc4DPC/?ref=app
you don't need to know C to learn C++, but it might help.
it's a bit like learning Spanish before learning Portuguese. it's not necessary/mandatory, but it could make learning the second one easier. on the other hand you might get confused between both and accidentally mix them.
- 1
Differences
C is Procedural Language,C++ is non Procedural i.e Object oriented Language.
No virtual Functions are present in C,The concept of virtual Functions are used in C++.
In C, Polymorphism is not possible,The concept of polymorphism is used in C++.
Operator overloading is not possible in C,Operator overloading is one of the greatest Feature of C++.
No namespace Feature is present in C Language,Namespace Feature is present in C++ for avoiding Name collision
C++ is derived from C Language. It is a Superset of C.Â