Visual Studio Next Generation: Language Enhancements

Polymorphism

Polymorphism refers to the ability to process objects differently depending on their data type or class. Additionally it provides the ability to redefine methods for derived classes. For example, given a base class of Employee, polymorphism enables the programmer to define different PayEmployee methods for any number of derived classes, such as Hourly or Salaried or Commissioned. No matter what type of Employee an object is, applying the PayEmployee method to it will return the correct results.

Class Employee
    Function PayEmployee()
       PayEmployee = Hours * HourlyRate
    End Function
Class CommissionedEmployee
    Inherits Employee
    Overrides Function PayEmployee()
       PayEmployee = BasePay + Commissions
    End Function

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone” - Bjarne Stroustrup