In a language where it is possible to define interfaces and typedefs (using Dart here):
abstract class Receiver {
void receive(int quantity);
}
typedef void Receive(int quantity);
abstract class Transport {
void deliver(Receiver receiver);
void deliver(Receive receive);
}
Conceptually, are single method interface and type definition on functions the same thing? Is there any benefits from using one over the other?
void (int)
. As long as you provide a function with that signature, it matches that definition.