what the use of Polymorphism?

  • Thread starter Thread starter chandu
  • Start date Start date
C

chandu

hello,

Exactly where we use the Polymorphism concept in a real time appliction.

please explian in detail.

thank u
 
HI,
You would use it when you need a class that could be used in different
ways. For instance try creating a 'Person' interface and then implement that
interface in a class called 'Man' - implement another class the 'Person'
interface and call this class 'Women' - Now both the 'Man' & 'Women' Classes
derive there members from the Person interface. The 'Man' is a 'Person' and
the 'Women' is a person. If we had created just two classes called 'Man' and
'Women' then they would have no connection and would also use most of the
same member names, even with the same logic. In a real time application you
would use it exactly the same way - You will need to plan your project with
polymorpism in mind, compare types, do they implement many of the same
features?

James
http://www.bandwidthvista.com
 
chandu said:
Exactly where we use the Polymorphism concept in a real time appliction.

please explian in detail.

Try study the GoF patterns in details.

Plenty of good usage of polymorphism there.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top