Is it possible to initialize static member with its own method eg. initialize()?
Example:
class Foo
{
//some private variables
public:
static Bar example;
//some methods
}
Then call it in main.cpp like:
Foo::example.initialize(argument);
Of course it does not work. Also it has lack in encapsulation because variable is public. I woud like it to be private and initialized just once. I do not have any other option than initializing it with a method.