http://d.puremagic.com/issues/show_bug.cgi?id=596
--- Comment #7 from [email protected] 2011-08-15 16:44:27 PDT --- One more useful use is with OOP (this is GUI code): import core.stdc.stdio; class Control {} class Slider : Control {} class Button : Control {} void main() { Control c = new Button; switch (typeof(c)) { case Slider: printf("A"); break; case Button: printf("B"); break; default: // probably a Control } } That is similar to this (but faster): import core.stdc.stdio; class Control {} class Slider : Control {} class Button : Control {} void main() { Control c = new Button; if (cast(Slider)c) { printf("A"); } else if (cast(Button)c) { printf("B"); } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
