Implementing Interfaces
Classes implement interfaces using the <: symbol and provide concrete implementations for all required methods. A class can implement multiple interfaces, separated by &.
Interfaces enable "contract-based programming": as long as a type satisfies the method signatures defined by an interface, it can be used wherever that interface is required. Multiple different types can implement the same interface with different behaviors.
Variables of interface type can only call methods declared in that interface and cannot access type-specific members. This ensures interface abstraction—callers don't need to care about the concrete type.
In this example, both Dog and Athlete implement the Runner interface but provide different implementations of run(). The showRun function accepts a Runner type parameter and can be passed any object that implements this interface.
Add a Robot class that implements Runner and call showRun(Robot()) in main.
public modifier because interface members are public by default. If you forget to add public, the compiler will report an error.