M
Minti
How do we initialize static const data in C++, I tried
class Foo
{
static const std::string name = "MyName";
};
I don't see any reason as to why this must not work.
Probably it is because that we are in a sense calling a non static
function[ The constructor of std::string]. But any other soluction(?)
to me would sound inelegant.
But I see no rationale for not allowing
class Foo
{
static const float bar = 23;
};
Can anybody put any _common_sense in this non-sense.
class Foo
{
static const std::string name = "MyName";
};
I don't see any reason as to why this must not work.
Probably it is because that we are in a sense calling a non static
function[ The constructor of std::string]. But any other soluction(?)
to me would sound inelegant.
But I see no rationale for not allowing
class Foo
{
static const float bar = 23;
};
Can anybody put any _common_sense in this non-sense.