- Overloading unary operators
- Non-static member function, no arguments
- Non-member function, one argument; Argument must be class object or reference to class object
- Remember, static functions only access static data
- Upcoming example (8.10)
- Overload ! to test for empty string
- If non-static member function, needs no arguments
- !s becomes s.operator!()
- class String { public: bool operator!() const; ...};
- If non-member function, needs one argument
- s! becomes operator!(s)
- class String { friend bool operator!( const String & ) ... }
2004-12-28