D/Objective-C 64bit

Michel Fortin via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Nov 20 17:07:18 PST 2014


On 2014-11-18 09:07:10 +0000, Christian Schneider said:

> This is what I came up with so far:
> 
> override KeyboardView initWithFrame(NSRect frame) [initWithFrame:] {
>      //my stuff
>      return cast(KeyboardView) super.initWithFrame(frame) ;
> }

Why not use a constructor and let the compiler manage the boilerplate?

	this(NSRect frame) [initWithFrame:] {
		//my stuff
		super(frame);
	}

This should emit the same code as the function above (but I haven't 
tested). And then you can write:

	auto view = new KeyboardView(someFrame);

and have proper type safety.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d-announce mailing list