4 ms·
> Is there some magic here that lets Dog and Cat know that they're implementing Animal? In this case, Animal is an interface - which means, a set of methods. T
by bheadmaster 3y ago
> Is there some magic here that lets Dog and Cat know that they're implementing Animal?
In this case, Animal is an interface - which means, a set of methods. The Animal interface in the example contains only a method "MakeNoise()". Any type (struct) that implements the method "MakeNoise()" implements the interface, and can be used whenever Animal is required.