-
December 17th, 2012, 12:08 AM
#1
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 = ....
}
-
December 17th, 2012, 01:00 AM
#2
Re: access member function
Use a global or create a dynamic instance inside your non member function.
◄◄ hypheni ►►
-
December 17th, 2012, 01:33 AM
#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?.
-
December 17th, 2012, 03:12 AM
#4
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?
-
December 17th, 2012, 07:49 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|