473,508 Members | 2,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Purpose of Keyword "Overloads"?

Hi all,

Im just curious, what is the purpose of the keyword "Overloads" in VB
nowadays?
I understand conceptually what overloads are and what they do, but im a
little puzzled,
because if you declare two subs or properties or functions with the same
name but
different signatures, it seems to overload them without any problem anyway,
so why
is the keyword there?
Does using the keyword just work as some sort of compiler hint or something
or ?

Cheers!
- Arthur Dent.
Apr 12 '06 #1
3 1734
Its just there... a optional use... no big deal if you use it or if you
don't...

Vijay

"Arthur Dent" <hi*********************@yahoo.com> wrote in message
news:eT**************@TK2MSFTNGP02.phx.gbl...
Hi all,

Im just curious, what is the purpose of the keyword "Overloads" in VB
nowadays?
I understand conceptually what overloads are and what they do, but im a
little puzzled,
because if you declare two subs or properties or functions with the same
name but
different signatures, it seems to overload them without any problem
anyway, so why
is the keyword there?
Does using the keyword just work as some sort of compiler hint or
something or ?

Cheers!
- Arthur Dent.

Apr 12 '06 #2
"Vijay" <vi***@msdiscussions.com> schrieb:
Its just there... a optional use... no big deal if you use it or if you
don't...


IIRC 'Overloads' is not always optional (see documentation).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Apr 12 '06 #3
Here's a simple example on where teh Overloads keyword is necessary:

Public MustInherit Class Class1

Public MustOverride Sub Method1()
Public MustOverride Sub Method1(ByVal x As Integer)
Public MustOverride Sub Method1(x as Integer, y as String

End Class

Public Class Class2
Inherits Class1

Public Overloads Overrides Sub Method1()

End Sub

Public Overloads Overrides Sub Method1(ByVal x As Integer)

End Sub

Public Overloads Overrides Sub Method1(ByVal x As Integer, ByVal y As
String)

End Sub
End Class

In the "Class2" definition, the "Overloads" keyword is necessary or your
code will not compile.

"Arthur Dent" wrote:
Hi all,

Im just curious, what is the purpose of the keyword "Overloads" in VB
nowadays?
I understand conceptually what overloads are and what they do, but im a
little puzzled,
because if you declare two subs or properties or functions with the same
name but
different signatures, it seems to overload them without any problem anyway,
so why
is the keyword there?
Does using the keyword just work as some sort of compiler hint or something
or ?

Cheers!
- Arthur Dent.

Apr 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1203
by: Fredrik Bertilsson | last post by:
I am trying to overload the "and" operatior, but my __and__ method is never called. The code look like this: class Filter: column = "" operator = "" value = "" def __init__(self, col, op,...
4
1795
by: Christian Christmann | last post by:
Hi, I'm reading "C++ Coding Standards" by Herb Sutter. On page 67 there's an example which I don't understand: --------------------------------- class Base{// ... virtual void Foo(int);...
11
18496
by: Brett | last post by:
What is the C# equivalent for this VB.NET code: Private WithEvents IE_Inst As New SHDocVw.InternetExplorer I get as far as: private SHDocVw.InternetExplorer IE_Inst = new...
9
6243
by: Hasan O. Zavalsiz | last post by:
Hi , i am trying to figure out which approach is better to use . let me explain the scenario. i am using the "Nortwind" database . in this database i have "Customers " table .The following is the...
9
7110
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
2
1182
by: Shane | last post by:
I'm creating a user control that has a textbox along with a couple of other controls in it. I'm mapping most of the textbox methods and properties to my control using the textbox names. I'm...
4
2029
by: Gary Brown | last post by:
Hi, Why are fn(object parameters) and fn(params object parameters)
6
1805
by: =?Utf-8?B?UmljaA==?= | last post by:
If Not st1.Equals("something") then Do Something Else End If if str1 != "something" Then ... I realize that != is C# stuff and/or can be also be used in Tsql, but is there any implementation...
5
1488
by: Polaris431 | last post by:
I notice that the Dataset designer generates code for properties that look like this: public string ID { get { try { return ((string) (this)); } catch (System.InvalidCastException e) {
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.