[RESOLVED] Regarding member function
Hi,
I was reading a c++ code written in embarcadero ide to add vertical colour text in popup menu.
While reading the code, I had seen following instructions.
private:
Code:
void __fastcall ExpandMenuItemWidth(TObject *Sender, TCanvas *ACanvas,int &Width, int &Height);
Code:
void __fastcall DrawNewItem(TObject *Sender, TCanvas *ACanvas, const TRect &ARect, bool Selected);
The above two methods used in the code like below:
Code:
PopupMenu1->Items->Items[i]->OnMeasureItem = ExpandMenuItemWidth;
PopupMenu1->Items->Items[i]->OnDrawItem = DrawNewItem;
What is happening when we are using member function without parameters like above?
I found above code at: http://edn.embarcadero.com/article/26632
Thanks in advance,
Re: Regarding member function
A function name is a pointer. So all you're doing is assigning the pointer to the function to another variable. Later on, that variable will call the function that it was assigned.
Regards,
Paul McKenzie
Re: Regarding member function
Quote:
Originally Posted by
Paul McKenzie
A function name is a pointer. So all you're doing is assigning the pointer to the function to another variable. Later on, that variable will call the function that it was assigned.
Regards,
Paul McKenzie
Thanks for your answer.