Hi,
i know this is probably a silly question, but the fact is i can't realize how to do this.
I have a ref class with operator -> redefined, but in a specific point of my code i want to acces a member of this class.
Example:
class N2
{
public:
N2(NativeClass nc);
};
ref class RC
{
public:
...
NativeClass* operator -> () {return m_p;}
static operator N2(RC^ rc) {return N2( *(rc->m_p) ); }
private:
NativeClass* m_p;
};
Since i can only acces the class with -> the conversion operator to N2 doens't compile. Any help
Thank you.

Accessing ref class when operator -> is redefined
ClaireS
G20
You can use a tracking reference to accomplish this.
static
operator N2(RC% rc) {return N2( *(rc.m_p) ); }msdnuser06
That solution compiles but i can't make this:
N2 n2;
RC^ rc= gcnew RC;
n2=rc; <--error, no conversion found.
Mark B .
FergusLogic
Yeah. Switching to a tracking ref isn't the best solution is it. Try this:
static
operator N2(RC^ rc) {return N2( *((*rc).m_p) ); }