Re: Compile-time reference type objects construction (Was - Re: struct

2008-12-22 Thread Denis Koroskin
Kagamin Wrote: > Denis Koroskin Wrote: > > > class Widget > > { > > WidgetFactory* factory = &defaultFactory; > > } > > > > void main() > > { > > Widget w = new Widget(); > > writefln(w.factory.someParameterValue); // prints 14 > > } > > You initialize member field here. It's usuall

Re: struct inheritance need?

2008-12-22 Thread Weed
Kagamin пишет: Weed Wrote: that is, suppose that after some action should get a matrix matrix3x1 Well... if you want to template every piece of your code, this can cause disaster, so I think, this is not very good design. For example, multiplication method will be duplicated N*N*N times for a

Re: struct inheritance need?

2008-12-22 Thread Kagamin
Weed Wrote: > that is, suppose that after some action should get a matrix matrix3x1 Well... if you want to template every piece of your code, this can cause disaster, so I think, this is not very good design. For example, multiplication method will be duplicated N*N*N times for all possible mat

Re: Compile-time reference type objects construction (Was - Re: struct

2008-12-22 Thread Kagamin
Denis Koroskin Wrote: > class Widget > { > WidgetFactory* factory = &defaultFactory; > } > > void main() > { > Widget w = new Widget(); > writefln(w.factory.someParameterValue); // prints 14 > } You initialize member field here. It's usually done in instance constructor. class Widge

Re: struct inheritance need?

2008-12-22 Thread Sergey Gromov
Sun, 21 Dec 2008 12:04:42 -0500, Kagamin wrote: > Sergey Gromov Wrote: > >> C++ static object constructors execute at run time except for trivial >> cases. > > Although I think it's not guaranteed to work this way and compiler > decides when to execute constructor. So code should be ready for >