Difference between revisions of "Pointer syntax"

From vegard.wiki
Jump to navigation Jump to search
(clarify names)
(add category)
 
Line 52: Line 52:
 
[[Category:C++]]
 
[[Category:C++]]
 
[[Category:Programming]]
 
[[Category:Programming]]
 +
[[Category:Cheat sheets]]

Latest revision as of 13:50, 18 April 2020

C/C++

Pointer to function

Declaration:

return_type (*function_name)(args...)

Pointer to member

Declaration:

member_type type::*member_name

Dereference:

type obj;
obj.*member_name
type *obj;
obj->*member_name

Pointer to member function

Declaration:

return_type (type::*member_name)(args...)

Dereference:

type obj;
(obj.*member_name)(args...)
type *obj;
(obj->*member_name)(args...)