Can't create nested classes

Heinz billgates at microsoft.com
Tue Jan 23 11:06:26 PST 2007


Jarrett Billingsley Wrote:

> 
> "Heinz" <billgates at microsoft.com> wrote in message 
> news:ep408i$2389$1 at digitaldaemon.com...
> 
> >        private Table mytable = new Table();
> 
> You're not allowed to have non-constant expressions in class member 
> initializers.  Move this 'new' into a constructor for myclass. 
> 
> 

I can't also have variables like 'int i', it throws access violation. But why in the DMD page here http://www.digitalmars.com/d/class.html is listed a bunch of classes with 1 to 3 non-static members like int i?

Man, C# is a lot more flexible in this topic, why can we have non-static members in C# and not in D?


More information about the Digitalmars-d-learn mailing list