What are the differences between inheritence and polymorphism?

Showing Answers 1 - 4 of 4 Answers

mangai

  • Jan 31st, 2006
 

Inheritance means a class is derived from the base class.The derived class contains base class's properties and its own properties.

Polymorphism means one name and many forms.The name is same but it do different things.

  Was this answer useful?  Yes

Inheritance : A class can be extending existing class & inheriting it's properties(attributes &  behaviours).

Polymorphism: Ability of an object to have more than one forms , which is direct result of inheritance

  Was this answer useful?  Yes

inheritance:is the propety that allows the reuse of an existing class to build a new class

polymorphism enables the same function to behave differently on diff classes.in java its overriding

  Was this answer useful?  Yes

salil.kaul

  • Apr 11th, 2006
 

Polymorphism can be classified into 2 categories:1. Overloading : When 2 or more functions of the same class performing same logical activity have same names but different signatures (type and order of parameters) then calls to such methods are bound at compile time (early binding).2. Overriding: This property is available for inherited classes (A by product of inheritance). When a derived class has same signature (method name and argument order & type) as it's parent class then a method invocation from a base class reference is bound at runtime (late binding) based on the object type the reference points to. That is if the object is of derived class the derived class method is called otherwise the if the object is of parent class the parent class implementation of the method is called

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions