aspose file tools
The moose likes Beginning Java and the fly likes whats the difference between polymorphism and inheritence Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "whats the difference between polymorphism and inheritence" Watch "whats the difference between polymorphism and inheritence" New topic
Author

whats the difference between polymorphism and inheritence

Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 970

whats the difference between polymorphism and inheritence,they tend seem to look same to me?


http://www.lifesbizzare.blogspot.com || OCJP:81%
Siddhesh Deodhar
Ranch Hand

Joined: Mar 05, 2009
Posts: 117
check this out


Good, Better, Best, Don't take rest until, Good becomes Better, and Better becomes Best.
Sidd : (SCJP 6 [90%] )
C Shinde
Ranch Hand

Joined: Oct 22, 2009
Posts: 60
Yes they are same as Inheritance in the means to achieve Polymorphism.


Regards,
Chetan Shinde
Deepika Singh
Greenhorn

Joined: Oct 10, 2008
Posts: 21
An ideal instance of using Inheritance would be when you want to create an entirely new class, but wish to borrow a group of existing attributes or methods resident in an existing Abstract or super Class, instead of re-inventing the wheel. If you had an Abstract Class Carnivore and wanted to create a subclass Cat, you could instantly inherit all the methods that were common in Carnivore that applied to Cat without writing new code.

Polymorphism could be best applied when you had an existing SubClass that you wanted to modify or add a feature that could borrow a method that existed in a higher class. Take the Cat subclass, which inherited attributes from Carnivore, and you wanted to add the method Stalk, which would generically describe how a carnivore approaches its prey. However its implementation in Cat would detail the stealth it uses that are unique to a Cat.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: whats the difference between polymorphism and inheritence
 
Similar Threads
Interview question?
enumeration and iterator difference
Set and Map
Overloading vs Polymorphism
getResource & getRealPath