I am new to scala and have questions on scala generics
Question is how animalContainer.add method is accepting new Cat. From my understanding B>:A - A is Animal and B is Cat. Cat is NOT super typs of animal . How it is working..
B is not Cat, B is Animal. The inferred type of add is then effectively:
def add(element: Animal)
You are able to pass Cat here because Cat extends Animal.