Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 21,779 times

Contents

Related Categories

Visual Studio Next Generation: Language Enhancements - Overloading

Microsoft

Overloading

Overloading is a feature that will allow an object's methods and operators to have different meanings depending on its context. Operators can behave differently depending on the data type, or class, of the operands. For example, x+y can mean different things depending on whether x and y are integers or structures. Overloading is especially useful when your object model dictates that you employ similar names for procedures that operate on different data types. For example, a class that can display several different data types could have display procedures that look like this:

Overloads Sub Display (theChar As Char)
...
Overloads Sub Display (theInteger As Integer)
...
Overloads Sub Display (theDouble As Double)

Without overloading, you'd have to create distinct names for each procedure even though they do the same thing:

Sub DisplayChar (theChar As Char)
...
Sub DisplayInt (theInteger As Integer)
...
Sub DisplayDouble (theDouble As Double)

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?