Programming to Interfaces simplification

Frustrated c1514843 at drdrb.com
Mon Feb 24 13:49:01 PST 2014


Fixed code with all combination examples:
(again, only WindowsButton works with WindowsGui and same for
LinuxGui... but the classes don't use iButton like they should!!!
Oh, they break the contract!! End of the world!)


http://dpaste.dzfl.pl/02ee45225303

Output:

Trying WindowsButton with WindowsGui!
Do(): WindowsButton
WindowsButton.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!


More information about the Digitalmars-d-learn mailing list