Mail Archives: djgpp/1997/04/07/13:36:35
This djgpp c++ test program:-
class cat{public: int kittens,micecaught;
void operator++();
void operator--();};
/*-----*/
void cat::operator++(){kittens=kittens+1;}
void cat::operator--(){kittens=kittens-1;}
main(){
cat Tabbins;
Tabbins++;
Tabbins--;
++Tabbins;
--Tabbins;}
caused these warnings when compiled with -Wall:-
t$.cc: In function `int main()':
t$.cc:9: warning: no `operator++ (int)' declared for postfix `++', using
prefix operator instead
t$.cc:9: warning: no `operator++ (int)' declared for postfix `++', using
prefix operator instead
t$.cc:10: warning: no `operator++ (int)' declared for postfix `++', using
prefix operator instead
t$.cc:10: warning: no `operator++ (int)' declared for postfix `++', using
prefix operator instead
(1) Line 10 used `--', but the warning re line 10 said `++'.
(2) Do these warnings now mean that now I can declare distinct postfix and
prefix ++ and -- operators to use with classes? If so, how?
- Raw text -