C++ code snippet for function pointer to member function of class
C++ code snippet for function pointer to member function of class
Tags: function pointer , member function
Code Snippet:
#include <iostream>
using namespace std;
class A
{
public:
void func()
{
cout << "Inside func of class A" << endl;
}
};
int main()
{
//function pointer declaration
void (A::*fp)(); //return type,(class::function pointer)(arguments)
fp = &A::func;//assigning
A *a = new A;
(a->*fp)();
}
ActionScript - ActionScript 3 - Apache - AppleScript - ASP - Assembler - Bash - C - C# - C++ - ColdFusion - CSS - Delphi - DOS Batch - Fortran - HTML - iPhone - Java - JavaScript - jQuery - Lisp - MatLab - Maxscript - MXML - MySQL - Objective C - Other - Pascal - Perl - PHP - PL SQL - Prolog - Pseudocode - Python - Rails - SmallTalk - Smarty - SML - SPSS - SQL - SVN - Symfony - TCL - VB.NET - Visual Basic - XHTML - XML - XSLT
© 2000-2015 Xentrik.Net