Follow

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
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.