samedi 9 décembre 2017

If you set Class A equal to Class B which class is the object? [duplicate]

This question already has an answer here:

For example, if you do the following instantiation:

Animal sparky = new Dog();

Is sparky then an object of Animal or an object of Dog?

And one other question: If you have an interface called Flys and you in class Animal instantiate that interface:

  public Flys flyingType;

would "flyingType" be called a variable or an object?

Aucun commentaire:

Enregistrer un commentaire