overloading operator<<
From: Mark P (not_at_my.real.email)
Date: 10/29/04
- Next message: Ulrich Eckhardt: "Re: help"
- Previous message: Jhonny: "help"
- Next in thread: Ulrich Eckhardt: "Re: overloading operator<<"
- Reply: Ulrich Eckhardt: "Re: overloading operator<<"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Oct 2004 13:28:05 -0700
If I want to be able to write:
cout << SomeClassObject;
then the model I've seen requires a declaration in the SomeClass defition:
friend ostream& operator<< (ostream& out, const SomeClass& obj);
Is there any other way to do this with operator<< defined as a member
function of SomeClass so that it would only require one argument?
Something like:
ostream& operator<< (ostream& out);
where of course the "this" parameter would take the place of "obj" in
the first declaration I displayed.
- Next message: Ulrich Eckhardt: "Re: help"
- Previous message: Jhonny: "help"
- Next in thread: Ulrich Eckhardt: "Re: overloading operator<<"
- Reply: Ulrich Eckhardt: "Re: overloading operator<<"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|