473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

overloading

I have a function 'Private MyFunc(ByVal dbS as String) As Boolean' where dbS
is a database value determined by the database reader method.

I was having some difficulty when dbS is null, so I decided to create an
overloaded function: 'Private Overloads MyFunc(ByVal dbS as DBNull) As
Boolean'. I added the Overloads keyword to the original also, of course.

This resulted in the run-time error "Public member 'MyFunc' on type
'MyClass' not found."

This did not make sense, but on a whim, I changed the Private declarations
to Public, and it worked fine. Can anyboday explain this? Why does
overloading change the requirements of Private/Public?

Thanks,

Dave
Nov 21 '05 #1
2 871
This cannot be erroring in the method's signature. If the value of the
argument is null, this can be passed into the method. It just needs
checking before it is used.

Landers
"Dave" <da*****************************@stic.net> wrote in message
news:uu**************@TK2MSFTNGP11.phx.gbl...
I have a function 'Private MyFunc(ByVal dbS as String) As Boolean' where dbS is a database value determined by the database reader method.

I was having some difficulty when dbS is null, so I decided to create an
overloaded function: 'Private Overloads MyFunc(ByVal dbS as DBNull) As
Boolean'. I added the Overloads keyword to the original also, of course.

This resulted in the run-time error "Public member 'MyFunc' on type
'MyClass' not found."

This did not make sense, but on a whim, I changed the Private declarations
to Public, and it worked fine. Can anyboday explain this? Why does
overloading change the requirements of Private/Public?

Thanks,

Dave

Nov 21 '05 #2
Thank you, but I'm not sure I understand your answer completely.

In MyFunc(), I did a Select Case for IsDBNull(), but it still didn't like
getting a null value when it expected a string, and it crashed. I suppose I
could do a Try-Catch for this specific exception, but I'm now mainly curious
about my original solution.

Do you have any insights on why you have to change Private to Public on an
overloaded function?

Thanks,

Dave
"Landley" <ne**@creations-software.co.uk> wrote in message
news:Ou**************@TK2MSFTNGP15.phx.gbl...
This cannot be erroring in the method's signature. If the value of the
argument is null, this can be passed into the method. It just needs
checking before it is used.

Landers
"Dave" <da*****************************@stic.net> wrote in message
news:uu**************@TK2MSFTNGP11.phx.gbl...
I have a function 'Private MyFunc(ByVal dbS as String) As Boolean' where

dbS
is a database value determined by the database reader method.

I was having some difficulty when dbS is null, so I decided to create an
overloaded function: 'Private Overloads MyFunc(ByVal dbS as DBNull) As
Boolean'. I added the Overloads keyword to the original also, of course.

This resulted in the run-time error "Public member 'MyFunc' on type
'MyClass' not found."

This did not make sense, but on a whim, I changed the Private declarations to Public, and it worked fine. Can anyboday explain this? Why does
overloading change the requirements of Private/Public?

Thanks,

Dave


Nov 21 '05 #3

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

Similar topics

17
by: Terje Slettebų | last post by:
To round off my trilogy of "why"'s about PHP... :) If this subject have been discussed before, I'd appreciate a pointer to it. I again haven't found it in a search of the PHP groups. The PHP...
4
by: Dave Theese | last post by:
Hello all, I'm trying to get a grasp of the difference between specializing a function template and overloading it. The example below has a primary template, a specialization and an overload. ...
5
by: | last post by:
Hi all, I've been using C++ for quite a while now and I've come to the point where I need to overload new and delete inorder to track memory and probably some profiling stuff too. I know that...
39
by: zeus | last post by:
I know function overloading is not supported in C. I have a few questions about this: 1. Why? is it from technical reasons? if so, which? 2. why wasn't it introduced to the ANSI? 3. Is there any...
45
by: JaSeong Ju | last post by:
I would like to overload a C function. Is there any easy way to do this?
31
by: | last post by:
Hi, Why can I not overload on just the return type? Say for example. public int blah(int x) { }
2
by: brzozo2 | last post by:
Hello, this program might look abit long, but it's pretty simple and easy to follow. What it does is read from a file, outputs the contents to screen, and then writes them to a different file. It...
15
by: lordkain | last post by:
is it possible to do some kind of function overloading in c? and that the return type is different
11
by: placid | last post by:
Hi all, Is it possible to be able to do the following in Python? class Test: def __init__(self): pass def puts(self, str): print str
10
by: Matthew | last post by:
Am I correct in thinking there is no method/function overloading of any kind in any version of PHP? Thanks, Matthew
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.