this pointer
Date: Fri, 31 Oct 2003 20:15:57 GMT
Some questions about "this" pointer:
1. To make an assignment function,
Stribg &String::operator=(const String &other)
{
...
return *this;
}
I have hard time to understand why "*this" matches a "String &" here. Could
someone shed some light on this?
2. In a static member function aren't there "this" pointer accessible inside
it?
3. In a const member function is the "this" pointer of const type while
non-const type in a non-const member?
Thanks in advance!
Relevant Pages
- Re: Function Pointer Query
... Note that pointer to member function is incompatible with regular ... needs a callback, you are sadly out of luck. ... void EnumWindows; ... (microsoft.public.vc.language) - Re: Why pointer to member function?
... I want a simple,clean,cheap way that can save the member function ... fixed for any type of closure. ... don't want to save a pointer to a pointer to a member function ... the boost lib does prove that I'm not wrong on this. ... (comp.lang.cpp) - Re: c[++] pointer question
... A pointer is a variable that contains a memory address. ... The above are member variables. ... A constructor is a special member function that is meant to initialize ... In modern C++ the initialization is better done via an initializer list, ... (comp.lang.cpp) - Re: Static member functions in VC
... What I want to achieve is NON static member function to be assigned as ... It is exactly right that it HAS TO contain pointer to an object itself. ... as Microsoft hasn't implemented any common solution of this problem in VC++ ... > instance pointer and a pointer to member function, ... (microsoft.public.vc.language) - Re: Basic question regarding checkboxes
... It appears that your real problem is not understanding that the above call is to a C++ member function. ... Your error message shows you are not calling the MFC version of CheckDlgButton but attempting to call the API version. ... The MFC version is a member function of the dialog and it "knows" the HWND of the dialog. ... If you are making this call in some code module that is not part of the dialog then first you have to call that module, passing it the 'this' pointer from the dialog object. ... (microsoft.public.vc.mfc) |
|