Is it possible to access to access and use static members within a class without first creating a instance of that class? Ie treat the the class as some sort of dumping ground for globals
James
On the other hand, that's what namespace are for:
namespace toolbox
{
void fun1();
void fun2();
}
The only use of classes of static functions is for policy classes.
Yes:
class mytoolbox
{
public:
static void fun1()
{
//
}
static void fun2()
{
//
}
static int number = 0;
};
...
int main()
{
mytoolbox::fun1();
mytoolbox::number = 3;
...
}
You can also call a static method through a null pointer. The code below will work but please don't use it:)