RE: static class declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux