Randy Yates said:
Mike Wahler said:
[...]
I_got_questions? said:
Thank you all for the suggestions. It is very helpful.
I perhaps should know more about C programming before I move to
C++.
No. This is a very common misconception. No knowledge
of one langauge is necessary in order to learn the other.
(As a matter of fact it can sometimes be a hindrance).
Strange that anyone would say this, since the overlap between the
two
is large.
Most of C is present in C++, but it not used much. The C++ standard
library is much more powerful, so many old C relics can be forgotten.
You don't have to start by learning about strcat(), malloc(),
pointers, mysterious arrays that are sometimes like pointers, why you
use pointers as parameters, etc, etc. Not to mention format strings!
I don't think it's "necessary" to learn C first, but it would
probably
be optimum, since, for the most part, C is a subset of C++, and
new concepts are usually better-learned in smaller chunks rather
than larger chunks.
It's not optimum, as you will have to un-learn a lot (see above
to
write good C++. The low level stuff can be saved for later, not used
as in introduction.
If you haven't tried out "Accelerated C++", you really should. Too me
it was quite amazing that C style arrays and pointers are put off
until chapter 10, where they are introduced as:
"An array is a kind of container, similar to vector but less powerful.
A pointer is a kind of random-access iterator that is essential for
accessing elements of arrays, and has other uses as well."
At this point the student already knows how to define his own classes
and write generic functions. Standard containers and iterators are
used to explain how pointers work!
The "other uses" for the pointer is really not explained much either,
because there is no good use for it! Instead the book goes on to
explain how to write abstract data types and value classes, which are
much more useful.
C++ just is another language!
Bo Persson