static class declaration
Rupert Wood
me@rupey.net
Thu Jan 8 14:51:00 GMT 2004
> I don't know if you can have a static class. You do can have a class
> with static members...
Or you can define class and a static instance of it at the same time, e.g.
static class foo
{
foo() {}
} bar;
which is equivalent to:
class foo
{
foo() {}
};
static foo bar;
i.e. the static belongs to the declaration of the variable and not the
class.
The case you originally asked about, static class but no variable, will
compile with MSVC but *does* generate a warning. g++ generates an error.
They're just reacting differently to invalid code.
Rup.
More information about the Gcc-help
mailing list