this() in struct

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Oct 9 10:54:16 PDT 2012


On Tue, Oct 09, 2012 at 07:08:35PM +0200, Zhenya wrote:
> On Tuesday, 9 October 2012 at 17:21:47 UTC, Zhenya wrote:
> >Hi!
> >I'm sorry,maybe this topic already was discussed,but could anybody
> >explain me why default constructor was disallowed in structs?
> 
> And if I have to do some initialization of data members,what is the
> way to do it?

Use initializers:

	struct S {
		int x = 1;
		int y = 2;
	}


T

-- 
"The whole problem with the world is that fools and fanatics are always
so certain of themselves, but wiser people so full of doubts."
	- Bertrand Russell.

"How come he didn't put 'I think' at the end of it?"
	-- Anonymous


More information about the Digitalmars-d-learn mailing list