Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Function pointer
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Method pointers== C++ includes support for [[object-oriented programming]], so classes can have [[method (computer programming)|methods]] (usually referred to as member functions). Non-static member functions (instance methods) have an implicit parameter (the ''[[this (computer programming)|this]]'' pointer) which is the pointer to the object it is operating on, so the type of the object must be included as part of the type of the function pointer. The method is then used on an object of that class by using one of the "pointer-to-member" operators: <code>.*</code> or <code>->*</code> (for an object or a pointer to object, respectively).{{Dubious|date=December 2022}} Although function pointers in C and C++ can be implemented as simple addresses, so that typically <code>sizeof(Fx)==sizeof(void *)</code>, member pointers in C++ are sometimes implemented as "[[fat pointer]]s", typically two or three times the size of a simple function pointer, in order to deal with [[virtual methods]] and [[virtual inheritance]]{{Citation needed|date=August 2011}}.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)