Advertisement
Membership
Login
ACCU Buttons
Search in Book Reviews
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
So I had a look for assignment. Here I was luckier because the index
took me to page 534 (note that the text of the book ends on page 575). Let
me show you the assignment operator provided on page 537 (see box):
const CEmployee& CEmployee::operator=(const CEmployee&Old)
{
// Make sure the employee name variables are empty.
// These should have been set to NULL in the constructor
// but you may be reusing an existing class object.
delete[] m_EmployeeFirst;
delete[] m_EmployeeLast;
// Reallocate memory for
// the names
m_EmplyeeFirst = new char [strlen(Old.m_EmployeeFirst) + 1];
m_EmplyeeLast = new char [strlen(Old.m_EmployeeLast) + 1];
strcpy(m_EmployeeFirst, Old.m_EmployeeFirst);
strcpy(m_Employeelast, Old.m_EmployeeLast);
m_EmployeeID = Old.m_EmployeeID;
return (*this);
}
The author has clearly never been anywhere near a respectable book on C++. He remembers to use the right version of
delete, and his return type is arguable though most experts advise that you return a plain reference. The parameter name is weird. All those things are purely idiosyncratic. The fact that he completely ignores the STL and usually uses C Library tools in preference to C++ ones says something about his heritage. However the failure to use either the old idiom for copy assignment nor the newer exception safe alternative is inexcusable.
The author's coverage of Visual Studio leaves much to be desired. That could be forgiven if he gave a correct introduction to C++, even an archaic one suitable for use with VC++ 1.0. He does not. I think reading this book will make learning C++ harder. This book is dangerous in that it re-enforces ignorance. Sadly, the author is blissfully unaware of the level of his ignorance, however those responsible for publication should not have been.
As far as I am concerned, the final nail in this book's coffin is the complete lack of any exercises or examples to be done by the reader. A book of 'lessons' without homework is like a reference book without an index - just about useless for the purpose that it claims to serve.