• Create Account

### #ActualAussieSpoon

Posted 27 January 2013 - 09:18 AM

Hello,

I have two classes. I am trying to get the 2nd class to have a member pointer that points to an instance of the first class (Giving the 2nd class the ability to edit an instance of the first class) . But I am unsure how to set this up (when I use it the values I try to edit don't change)

Here is what I have tried:

class A
{
m_MemberA;
};

class B
{
void SetMemberPointer(*A _a)  {m_MemberB = _a;}
A* m_MemberB
};

void main()
{
A Class1;
B Class2;

Class2.SetMemberPointer(&Class1);

}


Can some one explain why this doesn't work/help with a solution?

Thanks

### #2AussieSpoon

Posted 27 January 2013 - 09:17 AM

Hello,

I have two classes. I am trying to get the 2nd class to have a member pointer that points to an instance of the first class (Giving the 2nd class the ability to edit an instance of the first class) . But I am unsure how to set this up (when I use it the values I try to edit don't change)

Here is what I have tried:

class A
{
m_MemberA;
};

class B
{
void SetMemberPointer(*A _a)  {m_MemberB = _a;}
A* m_MemberB
};

void main()
{
A Class1;
B Class2;

Class2.SetMemberPointer(&ClassA);

}


Can some one explain why this doesn't work/help with a solution?

Thanks

### #1AussieSpoon

Posted 27 January 2013 - 09:16 AM

Hello,

I have two classes. I am trying to get the 2nd class to have a member pointer that points to an instance of the first class (Giving the 2nd class the ability to edit an instance of the first class) . But I am unsure how to set this up (when I use it the values I try to edit don't change)

Here is what I have tried:

class A
{
m_MemberA;
};

class B
{
void SetMemberPointer(*A _a)  {m_MemberB = _a;}
A* m_MemberB
};

void main()
{
A Class1;
B Class2;

Class2.SetMemberPointer(&ClassA);

}


Can some one explain why this doesn't work/help with a solution?

Thanks

PARTNERS