CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 1999
    Posts
    10

    Access function of View class

    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


  2. #2
    Join Date
    Apr 1999
    Posts
    6

    Re: Access function of View class

    You're missing the * int the method

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


  3. #3
    Join Date
    Apr 1999
    Posts
    10

    Re: Access function of View class

    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


  4. #4
    Join Date
    Apr 1999
    Posts
    6

    Re: Access function of View class

    Have you made this change both to the class definition (.h) and the
    implementation (.cpp)? If not, the compiler error makes sense



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured