At 04:07 PM 11/25/2004, you wrote:
Hi everyone,

First, a word of warning: I'm quite new to using C++ with to PODS.
And here's my problem:
gcc gives me "ANSI C++ forbids declaration `operator =' with no type" errors when trying to compile lines like
operator=( const Animal & inRHS );
Is there an option to switch that off in with compiler options? I don't want to change the code because it's part of the PAF C++ framework. Doee anyone have expericence in working with the PAF (or another C++ framework) under PODS?

Under strict ISO/ANSI C++ rules, an "operator =" needs to return a reference to the type of the first parameter or class that contains it.


So changing it to

Animal & operator=( const Animal & inRHS );

and adding a

"return *this;"

line to the end of the operator is needed to fix the code. Without this, you couldn't say

Animal a, b, c;
a = b = c;


-- Ben Combee, Technical Lead, Developer Services, PalmSource, Inc. "Combee on Palm OS" weblog: http://palmos.combee.net/ Developer Fourm Archives: http://news.palmos.com/read/all_forums/



--
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to