3

Possible Duplicate:
Try to describe polymorphism as easy as you can

How would you define polymorphism to a CS 101 student? Be as concise as possible (maybe an answer of a couple of lines and not too technical). Thanks

nabster
  • 1,561
  • 2
  • 20
  • 32

3 Answers3

6

Something that has the ability to change itself much like actors in films they can be either the good guy or the bad guy or even both or none. As non technical as I could get.

To extend my first example: the movie company doesnt need an actor to do a specific role as long as its a role.

In A somewhat more technical manner you tell three people to do a job but don't leave any instructions. Those three people will solve the job three different ways(if the job is unique lol) basically you dont care how it gets done as long as it gets done thats what polymorphism is.

Aquertu
  • 174
  • 1
  • 8
  • 1
    The best analogy I have ever read! Great one! – Pateman Oct 09 '11 at 09:06
  • Thanks! Between this and my post on an sql thread I've suprised myself twice :D man this is one awesome night got to talk to two major Ios devs too DHowett and rpetrich – Aquertu Oct 09 '11 at 09:09
1

I will dump down some one-liners from the top of my head. I think that various answers are necessarily due since polymorphism serves different purposes, depending on the consumer of the service. From formal to informal:

  1. Allow a multiplicity of automata to provide different semantics based on a common syntax.
  2. Allow a multiplicity of agents to provide specific behavior respecting a contract.
  3. You give a task to some students in a class, each one completes it correctly in its own personal way.
  4. You don't care who gets the job done or exactly how, as long as it satisfies some general criteria.
Luca Geretti
  • 10,206
  • 7
  • 48
  • 58
0

Exploiting guaranteed functionality among classes.

Mikhail
  • 7,749
  • 11
  • 62
  • 136