Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 21,843 times

Contents

Related Categories

Visual Studio Next Generation: Language Enhancements - Polymorphism

Microsoft

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

Comments

  • Object Oriented feature in VB

    Posted by ghanshyam on 12 Nov 2002

    The Object Oriented feature like Inheritance,Polymorphism,Encapsulation in Visual Basic is really a great achievement.Offcourse making a VB program as Multithreaded and allowing STructured exception h...

  • VB History

    Posted by jamsmith on 01 Aug 2002

    I am not sure if you have your whole VB history down. I learned VB from a Version 2.0 Demo. Also, did you also know there was Visual Basic for DOS?