How to call the operator << on an object instance ?

Apr 27, 2011 at 8:31am
I have MyclassA and operator << for it.
From MyclassB I have a public instance of MyclassA
( MyclassA * theclassA; )
( In turn, I have into my main a simple MyclassB myclassB; )

So ... I want to write
myclassB->theclassA<<"hello"

error: invalid operands of types 'MyclassA*' and 'const char [5]' to binary 'operator<<'

( This classA works fine if it is instantiated without pointer approach : MyclassA theclassA; )

Any idea ? Thanks

Last edited on Apr 27, 2011 at 8:32am
Apr 27, 2011 at 8:36am
Try this -> *(myclassB->theclassA) << "hello";
Apr 27, 2011 at 9:40am
Thank you very much
Topic archived. No new replies allowed.