Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!news.funet.fi!funic!santra!santra!Ari.Huttunen From: Ari.Huttunen@hut.fi (Ari Juhani Huttunen) Newsgroups: comp.lang.c++ Subject: Re: possible to overload << and pass an object ptr? Message-ID: Date: 24 Mar 91 20:24:27 GMT References: <1991Mar24.074308.28666@kestrel.edu> Sender: news@santra.uucp (Cnews - USENET news system) Organization: Helsinki University of Technology, Finland Lines: 16 In-Reply-To: gyro@kestrel.edu's message of 24 Mar 91 07:43:08 GMT In article <1991Mar24.074308.28666@kestrel.edu> gyro@kestrel.edu (Scott Layson) writes: >For these reasons I have toyed with the idea of proposing to the >committee a system for declaring "member functions" on the type `C*' >where C is some class, so that your first example could be made to >work without the two-level class structure. Unfortunately, I have >never managed to come up with a proposal I find adequately elegant. How about this one? struct S { friend void operator<<(S *s, char p1) { *s << p1; } void operator<<(char p1) { cout << p1; } }; -- Ari Huttunen, email: Ari.Huttunen@hut.fi, phone: 90-7285944