C ++ Static member function pointer - how to initialize it?

I have a static pointer to a function similar to the following in my class, but I'm not sure how to create it:

class Foo{ private: static double (*my_ptr_fun)(double,double); }; 
+7
source share
1 answer

Similarly, you must initialize each static member object in C ++ 03:

 class Foo{ private: static double (*my_ptr_fun)(double,double); }; double bar(double, double); double (*Foo::my_ptr_fun)(double,double) = &bar; 

In any case, you will need a pointer to a static function.

This is called initialization . instantiation means something else in C ++.

+7
source

All Articles