C vs C++

What are the decisive advantages of C++ over C of computational engineers?

I can think of
1. polymorphism, virtual functions as a decisive advantage which provides single interface for many different methods.
2. STL makes life a lot easier with so many different algorithms already implemented. However STL is not applicable everytime we want to write optimized codes.

Apart from this how is C++ much better than C?

Thank you
Apart from this how is C++ much better than C?


It's not. It's a different tool that is the right choice for some circumstances.
C++ is a direct descendant of C that retains almost all of C as a subset. C++ provides stronger type checking than C and directly supports a wider range of programming styles than C. C++ is "a better C" in the sense that it supports the styles of programming done using C with better type checking and more notational support (without loss of efficiency). In the same sense, ANSI C is a better C than K&R C. In addition, C++ supports data abstraction, object-oriented programming, and generic programming.

I have never seen a program that could be expressed better in C than in C++ (and I don't think such a program could exist - every construct in C has an obvious C++ equivalent). However, there still exist a few environments where the support for C++ is so weak that there is an advantage to using C instead. There aren't all that many of those left, though.

- Stroustrup http://www2.research.att.com/~bs/bs_faq.html#difference
Topic archived. No new replies allowed.