How does VB.NET/C# achieve polymorphism?

Showing Answers 1 - 6 of 6 Answers

Vijay

  • May 24th, 2005
 

Using abstract classes and functions

  Was this answer useful?  Yes

Pijush

  • Jul 31st, 2005
 

Polymorphism is form of several behaviour of a object in object hiararchi. The base classes keeps the mothods abstract which to be implimented by derrived classes to have different behaviour to provide polymor or more form of working !!!

  Was this answer useful?  Yes

samiksc

  • Jan 12th, 2006
 

VB.Net / C# provide polymorphism through the following mechanisms:

  1. Inheritance -- base class provides overridable methods which are re-implemented in derived classes.
  2. Interface -- different class can implement same interface, resulting in different implementations of interface methods.
  3. Virtual methods -- achieve runtime polymorphism.

Tresa

  • Mar 23rd, 2007
 

VB.Net achieves polymorphism thru
1. Overriding
2. Overloading

Polymorphism refers to an object taking different shapes in its life time . It is linked to inheritance .

Thru overloading, the same method  works with different parameters

 eg : public void  area(int parameter1)
              {

                     areavalue = parameter1 * parameter1;

               }

       public void area(int parameter1, int parameter2)
                  {
                    areavalue=parameter1*parameter2;  
                   }

Overiding : we override the methods in the abstract class.  Overriding is the process by which a method in the parent class is replaced by the derived class.

 public override void square();


  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