View Full Version : A bit OT but I need help...
07-29-2001, 09:25 PM
I've always been using C to program. Now I'm considering learning C++ for the OOP "benefits". Could someone with experience tell me what the advantage of C++ is over C and if it is really a big advantage or just a hyped phrase "Object Orientated Programming"... Thanks!
07-29-2001, 11:13 PM
Trying to start another flame war? http://www.opengl.org/discussion_boards/ubb/wink.gif I mostly use C++ and love it. I started programming in Pascal, then C. Here's my ideas.
Advantages of C++ over C:
Object oriented languages provide for easier to program/maintain large projects.
OO is a more natural way to think about your projects.
OO promotes reusability.
OO promotes good program design.
Disadvantages of C++:
Probably the most difficult language to learn, after machine code and assembly.
Slower - maybe, maybe not.
More overhead for smaller programs.
I'm sure other people will add their own ideas. C++ does provide rewards if you put in the time to learn it. You can always use only those features of C++ that you want to - a lot of people do, including some on these boards. C++ is a huge topic to learn. There are many eccentricities of the language and a lot to remember (much more than C or Java or Python or Perl or ...). If you really want to learn C++ get a good book and be prepared to put in the time. As a starter I would recommend Bjarne's "The C++ Programming Language, 3rd Edition". It can be a difficult read, but has (almost) everything you need within (Bjarne is the 'creator' of C++).
Hope that helps.
[This message has been edited by ffish (edited 07-30-2001).]
it's "oriented", not "orientATed". http://www.opengl.org/discussion_boards/ubb/tongue.gif
07-29-2001, 11:34 PM
LOL http://www.opengl.org/discussion_boards/ubb/biggrin.gif I've got a very esteemed lecturer at UWA who insists on using the phrase object orientated. I guess no one's ever pointed the correct way out to him!
talk about bloat that slashdot page got to 700kb before i pulled the plug.
theres quite an interesing thread on the c.g.d.p.m usenet forum at the moment about it
07-30-2001, 11:12 AM
I have just learned C and C++ in a software engineering MSc. I found that C++ is fairly straightforward once you understand c.
It is highly versatile and powerful, using things such as inheritance to promote logical connections between objects,data encapsulation, and because it is not Pure OO it is less restrictive.
It is especially useful in large projects, and i would recommend learning the UML to design and build your projects.
Basically, the OO aspect enables code reuse, and means you can Identify candidate objects when designing a system. Once you have these objects, you can work out what each objects resposiblities and abilites are and which object talks to which other objects.
It is a much more coherent way to produce a system, so go for it.
07-30-2001, 04:47 PM
Currently I am around intermediate level programmer in C, would you suggest learning C to a level of expert and then learning C++ OOP, or diving straight in?? Personally I prefer the former but I would appreciate suggestions...
08-02-2001, 03:10 AM
Other features of c++, which are at least as important as OOP, is more strict type checking and generics (a.k.a. templates in c++-speak).
Nevertheless, learning c++ is probably easier than learning c. Assuming you learn the c subset of c++, and use the STL containers whenever possible.
Once you learn how to do that, and code a few things, you'll discover you start thinking like 'it would be better if I could to it this way', and then at least I've found that C++ lets me do that in one way or another.
C++ isn't just an OOP-language, it's a multi-paradigm language. I.e. you can do procedural, objective-oriented or even functional programming in it.
Nevertheless, it does take quite a while to master, but it is my firm beleif that it is not harder to start producing results in C++ than in C. (quite the contrary, actually)
I coded in C++ as just 'a better C' for my first years, and progressed into using more and more features of it as I became more familiar with the language and as my programs grew and thus demanded more intricate designs to do what I wanted.
Just thinking of coding in straight C nowadays makes me want to run and hide. http://www.opengl.org/discussion_boards/ubb/smile.gif
Anyway, this is not the place to discuss this...
08-02-2001, 04:26 AM
I know this isn't the place to discuss this but ...
Originally posted by macke:
Nevertheless, learning c++ is probably easier than learning c.
Whaaat??!! macke, you're a brave man http://www.opengl.org/discussion_boards/ubb/wink.gif. Here's a list of stuff to learn:
Operator overloading, classes, single inheritance, polymorphism, multiple inheritance, exception handling, RTTI, namespaces, templates, STL, function objects
_plus_ all the C stuff that's a subset of C++ anyway. STL alone is _huge_. While I do know how to use all of the above to varying degrees, I always learn something new when I read one of my favourite texts on the subject (Effective C++, More Effective C++, Stroustrup's C++ Prog. Lang., The ANSI/ISO C++ Professional Programmers Handbook).
That said, I think it's well worthwhile learning C++. As macke says, you'll never look back. Also, if you're an expert C++ programmer, you're automatically probably an above average C programmer but definitely not vice versa. MrShoe, my advice is to go for it - dive in! http://www.opengl.org/discussion_boards/ubb/biggrin.gif
Nevertheless, it does take quite a while to master
You're telling me http://www.opengl.org/discussion_boards/ubb/wink.gif
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.