Pointer syntax: Difference between revisions

From vegard.wiki
Jump to navigation Jump to search
Content added Content deleted
(new page)
 
(function pointer)
Line 1: Line 1:
== C/C++ ==

=== Pointer to function ===

Declaration:

<source lang="C++">
return_type (*name)(args...))
</source>

=== Pointer to member ===
=== Pointer to member ===



Revision as of 08:31, 29 January 2020

C/C++

Pointer to function

Declaration:

return_type (*name)(args...))

Pointer to member

Declaration:

member_type type::*member

Dereference:

type obj;
obj.*member
type *obj;
obj->*member

Pointer to member function

Declaration:

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

Dereference:

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