+ 6
What is the transitive nature of Polymorphism ?
If possible, relate with Java.
2 Respostas
+ 8
Polymorphism can mean a lot of things, but you probably mean this:
class A { }
class B extends A { }
class C extends B { }
now you can do
A thing = new C();
So, `C` can change its shape to look like another class (so it's polymorphic), and you can cast `C` to `A` even though it doesn't directly inherit from it. It still works because inheritance is transitive (B extends A, C extends B, therefor C automatically extends A).
If you read that sentence in a tutorial somewhere you probably don't need to worry about it. Lots of big words but it is not important when learning about polymorphism. I'm not sure it even makes sense when you are talking about other kinds of polymorphism.
+ 5
Thanks !! Schindlabua