Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,29 @@
class Delegator {
var delegate;
String operation() {
if (delegate == null)
return "default implementation";
else
return delegate.thing();
}
}
class Delegate {
String thing() => "delegate implementation";
}
main() {
// Without a delegate:
Delegator a = new Delegator();
Expect.equals("default implementation",a.operation());
// any object doesn't work unless we can check for existing methods
// a.delegate=new Object();
// Expect.equals("default implementation",a.operation());
// With a delegate:
Delegate d = new Delegate();
a.delegate = d;
Expect.equals("delegate implementation",a.operation());
}