Topic: Beginner's luck
Author: kgb@windchime.arc.nasa.gov (Chuck Monahan)
Date: 11 Jul 91 21:38:44 GMT Raw View
I'm sure you've had plenty of first time user`s complain and bitch
about the simplest C++ elements, and I'm sorry to have to follow in
their footsteps.
What I've got:
I've just started using AT&T C++ 2.0 provided (or perhaps
mimiced) with the latest Saber C++ distribution (v 2.0.1)
What I want:
I want to define inserters and extractors for my own classes,
and I have begun this adventure by writing a *simple* example.
What's wrong:
My executable doesn't output the expected message, instead I
get the apparent address of the ostream.
The code:
#include <iostream.h>
typedef struct test{
int a,b;
} Test;
main()
{
Test var;
cout << &var << endl;
}
ostream& operator<<( ostream& out, Test& outVar) {
return out << "help";
}
The output:
kgb@windchime% test_string
0xf7fff910
kgb@windchime%
I hope the changes required to fix this code, will also clear the path
of any extractor problems.
-thanx in advance
--
- your friendly kgb agent :-)
---------------------------------------------------------------------
Who: kgb@opos.arc.nasa.gov
Witty saying: I don't want the world, I just just want your half - TMBG
Disclaimer: The views neither reflect the concensus of NASA or SJSU
because neither of them have a concensus!