By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,825 Members | 974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,825 IT Pros & Developers. It's quick & easy.

NotOverridable = still overloadable?

P: n/a
Is there any way to make a sub/function that you can neither override nor
overload? I cant seem to find any information on blocking the ability to
overload a function in a derived class..

Any help is appreciated,

Rick
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies

P: n/a
Rick,
| Is there any way to make a sub/function that you can neither override nor
| overload?
As you know, you can use NotOverridable to prevent a method from being
overridden, however you cannot prevent overloading.

Just out of curiosity, what do you think not overloading is going to buy
you?

Hope this helps
Jay

"Rick Mogstad" <Ri**********@GMail.NOSPAM.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
| Is there any way to make a sub/function that you can neither override nor
| overload? I cant seem to find any information on blocking the ability to
| overload a function in a derived class..
|
| Any help is appreciated,
|
| Rick
|
|
Nov 21 '05 #2

P: n/a

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
Rick,
| Is there any way to make a sub/function that you can neither override
nor
| overload?
As you know, you can use NotOverridable to prevent a method from being
overridden, however you cannot prevent overloading.

Just out of curiosity, what do you think not overloading is going to buy
you?


Its really to prevent another developer from overloading the function and
then complaining when it doesnt do what its supposed to. And its not really
my question, it was asked of me, and I didnt know the answer. So i guess I
dont know the whole reason, but I know that its more to prevent it so that
it will not confuse rather than that it will cause any actual harm.

Nov 21 '05 #3

P: n/a
Rick,
If "preventing" overloading was important, as you indicate they can be
"confusing" for some developers. You could always use or create a tool such
as FxCop with a rule that indicates that overloaded functions are bad. Then
use the tool as part of your code reviews.

I personal find overloading to be a very powerful & useful tool when writing
programss.

Hope this helps
Jay

"Rick Mogstad" <Ri**********@GMail.NOSPAM.com> wrote in message
news:u7**************@TK2MSFTNGP14.phx.gbl...
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
| news:%2***************@TK2MSFTNGP15.phx.gbl...
| > Rick,
| > | Is there any way to make a sub/function that you can neither override
| > nor
| > | overload?
| > As you know, you can use NotOverridable to prevent a method from being
| > overridden, however you cannot prevent overloading.
| >
| > Just out of curiosity, what do you think not overloading is going to buy
| > you?
| >
|
| Its really to prevent another developer from overloading the function and
| then complaining when it doesnt do what its supposed to. And its not
really
| my question, it was asked of me, and I didnt know the answer. So i guess
I
| dont know the whole reason, but I know that its more to prevent it so that
| it will not confuse rather than that it will cause any actual harm.
|
|
|
Nov 21 '05 #4

P: n/a

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ei*************@TK2MSFTNGP09.phx.gbl...
Rick,
If "preventing" overloading was important, as you indicate they can be
"confusing" for some developers. You could always use or create a tool
such
as FxCop with a rule that indicates that overloaded functions are bad.
Then
use the tool as part of your code reviews.

I personal find overloading to be a very powerful & useful tool when
writing
programss.

Hope this helps
Jay

We use overloading heavily, we just want to prevent a derived class from
overloading a method that is not overridable in the base class.
Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.