| Author |
Hi Question
|
Fred Man
Greenhorn
Joined: Nov 07, 2005
Posts: 8
|
|
what is What is polymorphism and why is it important in Object Oriented programming.? Please help
|
 |
Fred Man
Greenhorn
Joined: Nov 07, 2005
Posts: 8
|
|
|
Also can you give example of code
|
 |
Gaurav Chhabras
Ranch Hand
Joined: Sep 21, 2005
Posts: 126
|
|
First of all please keep this thing in your mind that Write some meaningful subject in the subject line so that one can see the subject and come to know that what type of question it contains This is Ranch policy , so please follow this. Now , regarding polymorphism, you can understand with the help of methord overriding. In this we have two different classes but some methords are with same name. Like -: class A { void test() { System.out.println("I am in Class A"); } } class B extends A { void test() { System.out.println("I am in Class B"); } } Now there are two classes A and B.Both have one function with same name i.e test(). Now at runtime it will depend on the Object that test() methord of which class will be get called. Thanks Regards Gaurav
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
Have a look at How My Dog Learned Polymorphism by Kathy Sierra.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Fred Man
Greenhorn
Joined: Nov 07, 2005
Posts: 8
|
|
yeah sorry about not mentioning the title of the topic in the suject, but you did not answer my secoud part of the question, y do programmers use this thank you
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
Read the story.
|
 |
 |
|
|
subject: Hi Question
|
|
|