Code



Compilation output:

@property iButton button(iButton b) { if (cast(WindowsButton)b is null) { writeln(`Invalid object type dependency mismatch! Type: `~(typeid(cast(Object)b).name)~` Type Expected: WindowsButton`); return null; }return button(cast(WindowsButton)b); } @property iButton button(iButton b) { if (cast(LinuxButton)b is null) { writeln(`Invalid object type dependency mismatch! Type: `~(typeid(cast(Object)b).name)~` Type Expected: LinuxButton`); return null; }return button(cast(LinuxButton)b); }


Application output:

Trying WindowsButton with WindowsGui! Do(): WindowsButton WindowsGui.foo(): I'm an extra WindowsButton feature! ...WindowsButton works in WindowsGui! Trying LinuxButton with WindowsGui! Invalid object type dependency mismatch! Type: f324.LinuxButton Type Expected: WindowsButton Trying WindowsButton with LinuxGui! Invalid object type dependency mismatch! Type: f324.WindowsButton Type Expected: LinuxButton Trying LinuxButton with LinuxGui! Do(): LinuxButton ...LinuxButton works in LinuxGui!

Paste info


Author: Guest
Views: 306
Private: no
Expires: Never
Uploaded: 24.02.14 22:44
Votes: 0

Compilation


Compiler: DMD 2.076.1 ( 2.076.1 )
Pointer size: m64

Actions