access member function
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: access member function

  1. #1
    Join Date
    Dec 2012
    Posts
    3

    access member function

    In my MFC, CMyPorpertyPageDlg is derived from CPropertyPage. How to access its member function from a nonmember function in the same CPP file?.
    void Non_Member_Get_PorpertyPage()
    {
    CMyPorpertyPageDlg* pPageDlg = ....
    }

  2. #2
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: access member function

    Use a global or create a dynamic instance inside your non member function.
    ◄◄ hypheni ►►

  3. #3
    Join Date
    Dec 2012
    Posts
    3

    Re: access member function

    I did the dynamic instance: CMyPropertyPagedlg* p = new CMyPropertyPagedlg(); This did not work. can you show me in actual code the both methods, if possible?.

  4. #4
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,062

    Re: access member function

    Why is it a non-member function?
    Can't you pass a pointer to the CMyPropertyPageDlg instance to the non-member function call?

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,231

    Re: access member function

    The typical approach there is to pass in a reference or pointer to the function. Failing that, unless you have a global instance of your object, there isn't much you can do.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center