DEV Community

Discussion on: ELI5: Why cast to an interface?

Collapse
 
miffpengi profile image
Miff

I don't really see a reason to explicitly downcast to an interface, but there are two situations I see about casting to an interface: when upcasting (when you don't know in advance if the object you're working with implements the interface) and the second is implicit casting (when you're calling code that operates on the interface only).