Implied generic types are easy, but you may wind up with a too-specific object.
In the previous lesson, critterCarrier
could only transport frogs. In the
snippet in this lesson, critterCarrier
can transport any sort of Animal
,
because we are passing an Animal
variable, not a Frog
variable, to the
Transport
constructor.
You can learn more about this in:
Tags: