+ 4

Why is this topic so difficult to understand?

8th Sep 2016, 2:03 AM
Andrea Hechanova
6 Antworten
0
polymorphism is tough to understand as it needs some exposure or hands on at the basics imho. it's 'poly' - 'morph'. ie multiple ways a single method declaration could take form of. never mind if yet u have not got it. Let me say I have a java file which has Animal class with behavior(method) 'makeSound'. I ask u to create Cat class by extending it. Now u can still create meow method but u feel it's bit out of the line (as it is). so u override the make Sound method in Cat class. now u got a Animal class and Cat class. Animal animal = new Cat(); we are declaring animal object of Type Animal and assigning a Cat type instance. ie animal object but cat instance. This is absolutely fine as Cat is an animal (cat extends Animal) now animal.makeSound() will print meow. makeSound method from animal object prints meow as per Cat class makeSound method. single method call but different behavior. polymorphism.
6th Jan 2017, 3:06 AM
Antony
- 1
IKR!
8th Sep 2016, 2:04 AM
Rojenn Claire Patigdas
Rojenn Claire Patigdas - avatar
- 1
idk either
8th Sep 2016, 2:05 AM
Valerie Castillo
Valerie Castillo - avatar
- 1
You will understand overtime.
8th Sep 2016, 2:07 AM
Kevin McMinn
Kevin McMinn - avatar
- 1
mitochondria is the powerhouse of the cell
8th Sep 2016, 2:07 AM
Joan Gamad
Joan Gamad - avatar
- 1
i understand n o t h i n g
8th Sep 2016, 2:18 AM
Althea Angela L. Roy