By inheriting from existing classes, you can produce more specialised versions of those classes, without the need to rewrite the common generic code, thus reducing code duplication.
theriyadhu
There are no advantages of C over C++ as such. Everything you can do in C you can also do in C++. However, by taking advantage of C++ object oriented programming, generic programming and template meta programming as well as C-style coding, you can produce more efficient machine code far more easily and more quickly than with C alone.
C can be faster than C++ programs, and definitely faster than Java, since Java is primarily interpreted. C is also somewhat less rigid in definitions as well, not as tightly structured as either C++ or Java can be.
C does not have any major advantages over C++ because any C program can be compiled under C++ with relatively minor modification. However, the C compiler works a bit quicker than that of C++ since there is no need to cater for object-oriented programming in C.
b+b+b+c+c+c+c =3b+4c
c + c + 2c + c + c = 6c
Everything you can do in C you can do in C++, with relatively minor variations in syntax. You can also incorporate C-style code directly. However, the main advantage is that C++ incorporates object-oriented programming, which allows highly complex data structures to be constructed far more easily than with C alone.
b + b + b + c + c + c + c = 3b + 4c
4c
c + c + c + c + c = 5 * c.
There are no "primary and secondary keys" in c and c plus plus.
3c