On May 23, 12:56 am, Anders Eriksson <andi...@gmail.com> wrote:
> I'm using a 3:rd party library and in one class I have a protected variable
> that I need to get.
>... The class looks like this
> xObject& operator*(){ return *m_pObject;}
> xObject* operator->(){ return m_pObject;}
>...
> If I have an instance of CYObject called myObject how do I get the
> myObject->m_pObject??
The first declaration is saying that if the * operator is used on a
CYObject then return a reference to an xObject.
The second declaration is saying that if the -> operator is used on a
CYObject then to return a pointer to an xObject.
Let's assume xObject has a public int called nValue.
For the first operator (*) you can use
xObject & myxObject = *myCYObject;
int myValue1 = myxObject.nValue;
and for the second operator (->) it's
int myValue2 = myCYObject->nValue;
> English is not my first, or second, language
> so anything strange, or insulting, is due to
> the translation.
> Please correct me so I may improve my English!
Your English is good.
Marc