TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JERRY COFFIN
from: DANIEL JONES
date: 1997-08-08 05:04:00
subject: Sunir ventures into C++

JC>  DJ> Please sketch me a class definition for an I/O stream which
JC>  DJ> doesn't use references and allows this:
JC>  DJ> cout << "I have " << Number << " apples.";
JC> I don't think this is the example you intended you use - if you try
Well, it was the example I intended to use.  Whether or not it proves my
point is another question. 
JC> do it, you'll find that while efficiency might be less than ideal (i
JC> `Number' is of some relatively large, complex type) but it's relativ
JC> easy and straightforward to code.  However, doing input like this:
It is?  Without references, your operator<< would have to return a
pointer to the ostream class.  I'm not aware of a way to concatenate
operators like this via a pointer to a class. Could you demonstrate?
JC> cout << "PLease enter the number of apples: " << flush;
JC> cin >> Number;
JC> is an entirely different story.  Doing this without a reference is q
JC> difficult indeed.
I'm really curious as to why this is easy and output is straightforward.
What am I missing here?
Regards,
Daniel              ddjones@pinn.net
---
 þ RM 1.31 1604 þ C++ programmers are classy.
---------------
* Origin: Selective Source Virginia Beach, VA (757)471-6776 (1:275/102)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.