In Java, if I want to delegate the foo and bar methods to my component a, I have to say something like:

public int foo(int x) {
return a.foo(x);
}

public void bar() {
a.bar();
}

Is there a programming language that natively supports delegation? I'm imagining something like:

delegate a: foo, bar;

This would make it much easier to choose composition over inheritance.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.