static class

Maxim Fomin maxim at maxim-fomin.ru
Mon Feb 18 00:20:28 PST 2013


On Sunday, 17 February 2013 at 22:26:16 UTC, Jonathan M Davis 
wrote:
> On Sunday, February 17, 2013 23:00:19 Michael wrote:
>> > That's not the meaning of static in that context.
>> 
>> As I understand a static class can't be instantiated.
>
> I have no idea how you came to that conclusion. That's not what 
> it means for a
> class to be static at all. The only place that static has any 
> effect on classes
> is for nested classes. A static, nested class is like any other 
> class except
> that it's inside another class, which affects its path. e.g.
>
> - Jonathan M Davis

That's not a surprise because dmd allows nonsense attributes. 
It's also not a surprise that somebody can hit in a such 
situation and deduce some sence from erroneous syntax 
construction. I often meet following:

public class Foo
{
    public int x;
    ....
}

Public is redundant, but code works, and one coming from C++/C# 
can think that's correct for considerable amount of time because 
this is what expected based on experience with other languages.


More information about the Digitalmars-d-learn mailing list