Interface Values
Variables of interface type act like "containers" that can store any value that implements that interface. Interface values internally hold a (value, type) pair, but only methods declared in the interface can be accessed through the interface variable.
This design brings great flexibility: you can store objects of different types in the same array and perform unified operations on heterogeneous collections. Callers don't need to care about concrete types, only what objects can do.
Interface variables can be reassigned to objects of different implementation types at any time, as long as the new type satisfies the interface requirements. This allows dynamic behavior switching at runtime.
In this example, Array<Drawable> stores three different types of objects: Line, Circle, and Rectangle. When iterating through the loop, each element calls the draw() and area() methods, but the actual code executed is different for each.
Add a Triangle class that implements Drawable and add it to the array.