Home > Back-end >  Polymorphic type transformation
Polymorphic type transformation

Time:03-25

Why a type equivalent to the dog, after a=new Cat1 () a becomes Cat1 object, not a type of dog, so is it not a dog type have you got a cat type new

CodePudding user response:

A just an ANIMAL reference it can point to any ANIMAL or ANIMAL subclass

CodePudding user response:

Here is your new initialization type to give a cat a assignment, the nature is a type of cat
  • Related