Click to See Complete Forum and Search --> : Access function of View class


Claude Gagnon
April 28th, 1999, 08:18 AM
Hi,
I want to access a member function of a view class from a custom class.
I have declare my view class a friend class of the custom class:
friend class CTestView;

In my custom class, I have a member function in wich I want to access a member function of my view class:

void Calcul_Int (CTestView pView)
{
int nombre;
nombre = pView->GetInt();
}


In my view class, I have:

CMyClass result;
CTestView* pView;
pView = this;
result.Calcul_Int(pView);

I can compile this code. I get the error message:

error C2664: 'Calcul_Int' : cannot convert parameter 1 from 'class CTestView *' to 'class CTestView'.

Can anyone give me some hints?

Thanks

Claude Gagnon

PKTonder
April 28th, 1999, 10:06 AM
You're missing the * int the method

void Calcul_Int (CTestView* pView)
{
int nombre;
nombre = pView->GetInt();
}

Claude Gagnon
April 28th, 1999, 10:33 AM
Thanks for your help,

Unfortunately that's not working.

I receive the following error message :

error LNK2001: unresolved external symbol "public: void __thiscall CMyClass::Calcul_Int(class CTestView *)" (?Calcul_Int@CMyClass@@QAEXPAVCTestView@@@Z)

If you have some hints, I will appreciate.

Claude GAgnon

PKTonder
April 29th, 1999, 02:32 AM
Have you made this change both to the class definition (.h) and the
implementation (.cpp)? If not, the compiler error makes sense