This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

some questions, please answer it

 
ishan kalra
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have encountered some questions, please tell me the exact answers

13.Which two techniques can be used to provide polymorphic behavior? Choose two

�Extending a class and adding a new method
�Implementing two interface in same class
�Extending the class and overriding a existing method
�Implementing a interfaces with several different classes


i am sure about 3rd option what other ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are your answers? We don't do people's homework for them here, but you can get help with doing it yourself.

Start by taking your best shot at the answers.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The word polymorphic means many forms (poly = many, mophic = forms).

So, polymorphism happens when an object can take on many forms. It really has to do with the instance that is created.

So, a person is a mammal, and an animal - that's two forms they can take on. A person can also be a spouse - that's another form they can take on. A person can be a dentist or a programmer - those are other forms.

In this scenario, if person were a class, maybe mammal would be a superclass, and perhaps animal would be an ancestor class. Spouse, programmer and dentist all seem like roles to me, so those might be modelled as interfaces.

So, extending a class, or implementing an interface, are ways that an instance of a subclass or implementing class can be polymorphic. That's what polymorphism is all about. Now, how that applies to your question is another story.

-Cameron McKenzie
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic