On Saturday, 22 February 2014 at 05:20:25 UTC, Eric Suen wrote:
Generic?


I don't see how this would help. I'd have to specify every
concrete type in the creation of the object which might be
significant. I can't use a generic virtual method so that doesn't
help either.

It would be nice to have something like

T foo(T : iButton)(T button);

Which then I override with

WindowsButton foo(WindowsButton button) { }

Since WindowsButton is derived from iButton. The compiler would
have to insert a type check to make sure when I called the first
one(from the interface) that it was a windows button that was
passed(since any iButton could be passed) when using the
WindowsGui.

The main point of all this is simply efficiency. I have to liter
the code with checks and casts when it is entirely possible to
get the compiler to automate it all. By doing so one can program
the concrete class in a much more natural way.


Reply via email to