operator overloading problem

Hi can someone help me with this code?

i want to write somthing like:
 
*dataStream >> this;




instead of
 
*dataSteam >> this->x >> this->q >> this->com;


how can i make the overloading ?
I can't write somthing like

1
2
3
4
void operator >>(QdataStream *stream, this *p)
{
	...
}
hey, thx
but I have really no idea,
if it is even possible
how to solve my example

First, you should really want to write *dataStream >> *this rather than *dataStream >> this. In other words, you want to populate the object, not the pointer.

If this is type MyType* then you need to write operator >> (QdataStream &stream, MyType &object). Note that the first object is a reference, not a pointer. The operator should return Qdatastream &. That way you can do
1
2
string thatsCool;
*dataStream >> *this >> thatsCool;

Topic archived. No new replies allowed.