C++ examples for Class:static member
Here's an example class with a static function:
#include <iostream> #include <string> using namespace std; class Util/* w w w.ja v a2s . c o m*/ { public: static string MyClassName() { return "Util!"; } int WhichUtil; int Chew(string name) { cout << WhichUtil << endl; cout << name << endl; return WhichUtil; } }; int main() { typedef string (*StaticMember)(); StaticMember staticfunc = &Util::MyClassName; cout << staticfunc() << endl; }