Warren Myers wrote:
I personally prefer #ifndef .. #endif clauses for making sure they're only
defined once.
One of my friends made this suggestion as well, I need to look into it.
He said #pragma was a pretty compiler specific flag, and this code will
need to run in Linux, Unix, and Windows, so this is something I need to
fix too. Thanks!
If I recall correctly, since + is a binary operator, you need to have both
arguments in the function definition:
point3d operator+ (point3d &lhs, &vector3d &rhs);
The minus sign (-) can be either unary or binary, so you need to make sure
that if you're trying to do a subtraction you have both arguments in the
function definition.
I think you would do this for global operators, but since these are
members of a class, the class object is assumed to be one of the
arguments by default, and so you only need to supply one type.
If the classes reference each other, they eed to be in the same header file.
Though I would ask how you plan to add a vector to a point and get a point
back... so it might make the most sense to put all of the vector operators
in the vector class, and the point-only operators in the point class.
Thanks to you too Warren!
--
Randy Barlow
Research Assistant
Department of Electrical and Computer Engineering
North Carolina State University, Raleigh, NC
[EMAIL PROTECTED]
http://www.electronsweatshop.com
--
TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/