Thread overview | |||||
---|---|---|---|---|---|
|
March 13, 2005 static attribute on class declaration | ||||
---|---|---|---|---|
| ||||
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. |
March 13, 2005 Re: static attribute on class declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to John C | "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 |
March 14, 2005 Re: static attribute on class declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | > 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
|
Copyright © 1999-2021 by the D Language Foundation