advertisement

Article:
  Strings in Cocoa: Part I
Subject:   operator overloading
Date:   2001-07-03 17:05:01
From:   canyonrat
Response to: operator overloading

The assignment declaration is:
classname& operator= const classname&(rhs);


For an equality test its:


bool operator== const classname&(rhs);


This is why the the problem that you hypothesize never really happens. Even a language as weakly typed as ObjC is going to catch the difference between reference to object and bool.


The only language that I have ever used that didn't catch the difference between assignment and comparison was Java. Everything else at least issues a warning.