|
From: Roger F. <ra...@ha...> - 2004-08-25 04:46:32
|
Aloha from Honolulu,
I've been learning C++ using "Sam's Teach Yourself C++" and when I
came across "Effective C++ Second Edition" in a used-book store, I
picked it up (both books mention each other). My reference book had
been "Turbo C/C++ The Complete Reference (Second Edition)" which was
copyright 1992 (I was using Windows 3.1 and Borland's Turbo C++ 3).
Finding the reference to be so out-of-date, I bought a new one: "The
Complete Reference C++ Fourth Edition". This has a 2003 copyright and
is much more up-to-date. I find it very useful when looking up
specifics of things mentioned in the first two books.
My questions for the group have to do with using the ampersand (&)
for references.
First: in "Effective C++", item 15, p. 65:
"operator= default version C& C::operator=(const C&);"
The & follows the variable (?).
But in "The Complete Reference" on p. 347 the author states
"... as specified in the C++ syntax, when used in a
declaration, the * (or &) is linked to the individual variable that it
_/precedes/_, (my emphasis) not to the type that it follows."
Second: In both "Sam's Teach Yourself..." and "Effective C++" the
authors use "rhs" and "lhs" throughout.
Example from "Teach Yourself C++" p.203: defining a class called
"CAT" the following is the declaration for the copy constructor on line 8:
8: CAT (const CAT &); // copy constructor
Later on line 27 it is defined:
27: CAT::CAT(const CAT & rhs)
28: { ... the definition continues...
The author makes it clear that "rhs" stands for "right hand side" and
"lhs" for "left hand side" and from the way they use them I have a
pretty good idea of what they mean, but I can find no mention of either
one in "The Complete Reference" and nowhere is there anything like line
8 above: (const CAT &) where the & is at the end.
Can anyone clear this up for me?
Much thanks in advance.
Mahalo,
Roger
|