digitalmars.D - static attribute on class declaration
- "John C" <johnch_atms hotmail.com> Mar 12 2005
- "Walter" <newshound digitalmars.com> Mar 12 2005
- "Craig Black" <cblack ara.com> Mar 14 2005
Purely by accident, I discovered that the compiler doesn't issue an error
when the static attribute is used in a class declaration, like so:
public static class MyClass {
}
It doesn't appear to be documented, so does it have a purpose? I initially
thought it might be a shorthand for final and abstract (classes that can
neither be instantiated nor derived from), but no.
Anyway, just curious.
John.
Mar 12 2005
"John C" <johnch_atms hotmail.com> wrote in message news:d102ra$skm$1 digitaldaemon.com...Purely by accident, I discovered that the compiler doesn't issue an error when the static attribute is used in a class declaration, like so: public static class MyClass { } It doesn't appear to be documented, so does it have a purpose? I initially thought it might be a shorthand for final and abstract (classes that can neither be instantiated nor derived from), but no.
Because of the way attributes are parsed, ones that make no sense are just ignored. This is for things like: static: // everything that follows is static
Mar 12 2005
Because of the way attributes are parsed, ones that make no sense are just ignored. This is for things like: static: // everything that follows is static
Cool. -Craig
Mar 14 2005








"Craig Black" <cblack ara.com>