There are some problems with the book.
An important component of C++ is the Standard Template Library (STL) which contains various container types (strings, vectors, etc.) and a set of standard algorithms for generic programming. You should be learning to use it starting from day one, however the only
mention of STL is at the end of lesson 23, where the author spares a few lines saying that there's "the STL which is an alternative (sic) to keeping on reinventing the wheel [...] and it's even free!" Yeah, so much for the STL in a book that claims to teach C++.
The other parts of the C++ standard library other than iostream are also left out. std::swap? Apparently he hasn't heard of it, as he keeps defining his own variant in various code examples.
The bool type? Nope. We keep seeing
typedef int BOOL; and
enum BOOL {FALSE,TRUE}; in the examples.
The author also keeps using bad examples and/or does not explain them. Somewhere around lesson 10 there's a code example where he mentions that it's possible to "allocate class member member variables using new and delete in the destructor" then gives a different version of a previously used Cat class which now allocates its age and weight dynamically.
With that, he apparently things the subject is sufficiently explained and moves on. He neither mentions that the example is nonsense nor does he explain in which situations it should be used - things like this constantly lead to questions like "what's the point of new" in this and other forums.
While we're at it: he says "one has to check the return value of new for NULL every time" and promptly does just that in his next code example. Of course, that's the only time where he actually does it and in any case, it ignores the fact that new does
not return 0 on failure, but throws a std::bad_alloc exception.
Now to be fair, I have an older version of the book, so in theory he could have improved the book in later editions.
But I don't have too much hope for that, at least the code example you posted with good old Frisky is just like what I remember.
Are any of those books in your link readable for a person with zero programming experience (before this)? |
Not entirely sure about all the books, but the C++ Primer should be suitable in any case.