Re: readonly member (but assignable at constructor time)

2018-04-30 Thread bauss via Digitalmars-d-learn
On Monday, 30 April 2018 at 10:57:51 UTC, Jonathan M Davis wrote: On Monday, April 30, 2018 10:36:52 bauss via Digitalmars-d-learn wrote: On Saturday, 28 April 2018 at 04:56:26 UTC, lempiji wrote: > On Friday, 27 April 2018 at 02:59:16 UTC, Dr.No wrote: >> In C# you can have a readonly member

Re: readonly member (but assignable at constructor time)

2018-04-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 30, 2018 10:36:52 bauss via Digitalmars-d-learn wrote: > On Saturday, 28 April 2018 at 04:56:26 UTC, lempiji wrote: > > On Friday, 27 April 2018 at 02:59:16 UTC, Dr.No wrote: > >> In C# you can have a readonly member assignable either at > >> declaration or constructor time, like

Re: readonly member (but assignable at constructor time)

2018-04-30 Thread bauss via Digitalmars-d-learn
On Saturday, 28 April 2018 at 04:56:26 UTC, lempiji wrote: On Friday, 27 April 2018 at 02:59:16 UTC, Dr.No wrote: In C# you can have a readonly member assignable either at declaration or constructor time, like this: class C { readonly myClass mc; this() { mc = new myClass(); }

Re: readonly member (but assignable at constructor time)

2018-04-27 Thread lempiji via Digitalmars-d-learn
On Friday, 27 April 2018 at 02:59:16 UTC, Dr.No wrote: In C# you can have a readonly member assignable either at declaration or constructor time, like this: class C { readonly myClass mc; this() { mc = new myClass(); } void doSomething() { mc = new myClass(); // wrong!

Re: readonly member (but assignable at constructor time)

2018-04-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, April 27, 2018 02:59:16 Dr.No via Digitalmars-d-learn wrote: > In C# you can have a readonly member assignable either at > declaration or constructor time, like this: > > class C > { >readonly myClass mc; > >this() >{ > mc = new myClass(); >} > > >void

readonly member (but assignable at constructor time)

2018-04-26 Thread Dr.No via Digitalmars-d-learn
In C# you can have a readonly member assignable either at declaration or constructor time, like this: class C { readonly myClass mc; this() { mc = new myClass(); } void doSomething() { mc = new myClass(); // wrong! result in compiler error, mc is readonly } } Does D