struct init property

Dmitry Olshansky dmitry.olsh at gmail.com
Thu Aug 23 11:58:36 PDT 2012


On 23-Aug-12 22:44, Namespace wrote:
> It would be great if you could declare your own .init as you can atm
> with "new" (http://dlang.org/class.html#allocators).
>
Read on :
Note: Class allocators are deprecated in D2.

> For example:
>
> class Foo {
> public:
>      init() {
>          this = new typeof(this)();
>      }
> }
>
> So you could avoid a null declaration by default. :)


-- 
Olshansky Dmitry


More information about the Digitalmars-d-learn mailing list