SlideShare a Scribd company logo
2
Most read
4
Most read
VB.NET:- Over Loading
BCA -501
2
What is overloading?
 Overloading is the process of declaring methods of a class having the same name but
different signatures.
 The signature of a method comprises of the name of the method, the number and types
of arguments. The return type of method is not a part of the signature and hence cannot
be used as a factor for overloading.
 In VB.NET, functions, procedures, constructor and properties within a class can be
overloaded.
 The Overloads keyword is optional when overloading, but if any overloaded member
uses the Overloads keyword, then all other overloaded members with the same name
must also specify this keyword.
3
Example of Procedure Overloading
Module Module1
Public Class X
Sub Sum(a As Integer, b As Integer)
Dim c As Integer
c = a + b
Console.WriteLine("Sum of {0} and {1} is {2}", a, b, c)
End Sub
Sub Sum(a As String, b As String)
Dim c As String
c = a + b
Console.WriteLine("The concatenated string is " & c)
End Sub
End Class
Sub Main()
Dim Y As New X()
Y.Sum(10, 20)
Y.Sum("Hello", " World")
Console.ReadKey()
End Sub
End Module
4
Constructor Overloading
Module Module1
Public Class X
Public Sub New()
Console.WriteLine("Parameterless Constructor is called")
End Sub
Public Sub New(X As Integer)
Console.WriteLine("Integer parameter is passed through
Constructor")
Console.WriteLine("Value passed : {0}", X)
End Sub
Public Sub New(X As String)
Console.WriteLine("String parameter is passed through
Constructor")
Console.WriteLine("Value passed : {0}", X)
End Sub
End Class
Sub Main()
Dim x1 As New X()
Dim x2 As New X(10)
Dim x3 As New X("Programming")
Console.ReadKey()
End Sub
End Module
 Constructor Overloading is a special
case of method overloading.
 Parameterized Constructors that satisfy
the rule for overloading can be used
within classes.

More Related Content

PPTX
Unit ii
PPTX
Object Oriented Programming - Constructors & Destructors
PPTX
DOCX
Uta005
PPTX
4. method overloading
PPTX
9 Inputs & Outputs
PDF
Intake 37 linq2
Unit ii
Object Oriented Programming - Constructors & Destructors
Uta005
4. method overloading
9 Inputs & Outputs
Intake 37 linq2

What's hot (20)

PPTX
constructors in java ppt
PDF
Intake 37 linq3
PPTX
function overloading
PDF
Chapter22 static-class-member-example
PDF
Clojure
PPTX
Constructor&method
PPTX
Lecture 4.2 c++(comlete reference book)
PPT
Csc1100 lecture13 ch16_pt1
PDF
Polymorphism in Java by Animesh Sarkar
PPTX
Constructor ppt
PDF
E1
PPTX
constructor & destructor in cpp
PPT
Review constdestr
PDF
Constructors destructors
PPTX
19csharp
PDF
Intake 37 linq1
PDF
Constructors and Destructors
DOC
Xii Compsc Hw
PPT
Lecture 2
PPTX
Classes and objects
constructors in java ppt
Intake 37 linq3
function overloading
Chapter22 static-class-member-example
Clojure
Constructor&method
Lecture 4.2 c++(comlete reference book)
Csc1100 lecture13 ch16_pt1
Polymorphism in Java by Animesh Sarkar
Constructor ppt
E1
constructor & destructor in cpp
Review constdestr
Constructors destructors
19csharp
Intake 37 linq1
Constructors and Destructors
Xii Compsc Hw
Lecture 2
Classes and objects
Ad

Similar to Overloading (20)

PPTX
Function overloading
PPT
C# Method overloading
PPTX
Function overloading and overriding
PPTX
Inheritance
PDF
22 scheme OOPs with C++ BCS306B_module1.pdf
PPTX
Advanced programming topics asma
PPTX
PPTX
C++ language
ODP
Ppt of c++ vs c#
PPTX
Microsoft dynamics ax 2012 development introduction part 2/3
PPTX
Presentation 3rd
PPTX
‫Chapter3 inheritance
DOCX
Sdtl assignment 03
PPTX
Lab 6- Constructors in c++ . IST .pptx
PPTX
Object Oriented Programming using C++ Unit 1
PPTX
UNIT3 on object oriented programming.pptx
PDF
Java unit2
PPTX
introduction to object oriented programming language java
DOCX
Java execise
PDF
classes and objects.pdfggggggggffffffffgggf
Function overloading
C# Method overloading
Function overloading and overriding
Inheritance
22 scheme OOPs with C++ BCS306B_module1.pdf
Advanced programming topics asma
C++ language
Ppt of c++ vs c#
Microsoft dynamics ax 2012 development introduction part 2/3
Presentation 3rd
‫Chapter3 inheritance
Sdtl assignment 03
Lab 6- Constructors in c++ . IST .pptx
Object Oriented Programming using C++ Unit 1
UNIT3 on object oriented programming.pptx
Java unit2
introduction to object oriented programming language java
Java execise
classes and objects.pdfggggggggffffffffgggf
Ad

More from Jaya Kumari (20)

PPTX
Python data type
PPTX
Introduction to python
PPTX
Variables in python
PPTX
Basic syntax supported by python
PPTX
PPTX
Inheritance
PPTX
Decision statements
PPTX
Loop control statements
PPTX
Looping statements
PPTX
Operators used in vb.net
PPTX
Variable and constants in Vb.NET
PPTX
Keywords, identifiers and data type of vb.net
PPTX
Introduction to vb.net
PPTX
Frame class library and namespace
PPTX
Introduction to .net
PPTX
Jsp basic
PPTX
Java script Basic
PPTX
Sgml and xml
PPTX
Java script Advance
PPTX
Html form
Python data type
Introduction to python
Variables in python
Basic syntax supported by python
Inheritance
Decision statements
Loop control statements
Looping statements
Operators used in vb.net
Variable and constants in Vb.NET
Keywords, identifiers and data type of vb.net
Introduction to vb.net
Frame class library and namespace
Introduction to .net
Jsp basic
Java script Basic
Sgml and xml
Java script Advance
Html form

Recently uploaded (20)

DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Cell Types and Its function , kingdom of life
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
RMMM.pdf make it easy to upload and study
PDF
Updated Idioms and Phrasal Verbs in English subject
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Lesson notes of climatology university.
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Classroom Observation Tools for Teachers
PDF
Computing-Curriculum for Schools in Ghana
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Cell Types and Its function , kingdom of life
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Chinmaya Tiranga quiz Grand Finale.pdf
Supply Chain Operations Speaking Notes -ICLT Program
RMMM.pdf make it easy to upload and study
Updated Idioms and Phrasal Verbs in English subject
STATICS OF THE RIGID BODIES Hibbelers.pdf
Lesson notes of climatology university.
History, Philosophy and sociology of education (1).pptx
Weekly quiz Compilation Jan -July 25.pdf
Complications of Minimal Access Surgery at WLH
Classroom Observation Tools for Teachers
Computing-Curriculum for Schools in Ghana

Overloading

  • 2. 2 What is overloading?  Overloading is the process of declaring methods of a class having the same name but different signatures.  The signature of a method comprises of the name of the method, the number and types of arguments. The return type of method is not a part of the signature and hence cannot be used as a factor for overloading.  In VB.NET, functions, procedures, constructor and properties within a class can be overloaded.  The Overloads keyword is optional when overloading, but if any overloaded member uses the Overloads keyword, then all other overloaded members with the same name must also specify this keyword.
  • 3. 3 Example of Procedure Overloading Module Module1 Public Class X Sub Sum(a As Integer, b As Integer) Dim c As Integer c = a + b Console.WriteLine("Sum of {0} and {1} is {2}", a, b, c) End Sub Sub Sum(a As String, b As String) Dim c As String c = a + b Console.WriteLine("The concatenated string is " & c) End Sub End Class Sub Main() Dim Y As New X() Y.Sum(10, 20) Y.Sum("Hello", " World") Console.ReadKey() End Sub End Module
  • 4. 4 Constructor Overloading Module Module1 Public Class X Public Sub New() Console.WriteLine("Parameterless Constructor is called") End Sub Public Sub New(X As Integer) Console.WriteLine("Integer parameter is passed through Constructor") Console.WriteLine("Value passed : {0}", X) End Sub Public Sub New(X As String) Console.WriteLine("String parameter is passed through Constructor") Console.WriteLine("Value passed : {0}", X) End Sub End Class Sub Main() Dim x1 As New X() Dim x2 As New X(10) Dim x3 As New X("Programming") Console.ReadKey() End Sub End Module  Constructor Overloading is a special case of method overloading.  Parameterized Constructors that satisfy the rule for overloading can be used within classes.