473,466 Members | 1,366 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

All methods are virtual?

I read this on this website page
http://www.vbip.com/books/1861004915...r_4915_06.asp:

Unlike many object-oriented languages, all methods in VB.NET are virtual.

Now in BOL, Under Perforamce Tips and Tricks in .NET Applications, A .Net
Developer Platform White Paper, at the very bottom, it says:

The JIT cannot inline virtual methods, so you lose a potential optimization
if you get rid of non-virtual methods.

So does this mean any method written in VB cannot be inlined, because they
are compiled as virtual? If so, whats the purpose of NotInheritable, or
NotOverridable?

If someone can point me to someplace that will help me on understanding this
discrepency, I would appreciate it. To this point, I've always understood
that VB.Net methods were not virtual if not declared explicitly as
Overridable, and could therefore have the possibility of being inlined.

Raymond Lewallen
Federal Aviation Administration
Jul 21 '05 #1
20 1730
Raymond Lewallen <Ra******************@nospam.faa.gov> wrote:
I read this on this website page
http://www.vbip.com/books/1861004915...r_4915_06.asp:

Unlike many object-oriented languages, all methods in VB.NET are virtual.


It's wrong - at least by what I consider the meaning of "virtual" to be
(namely that it can be overridden).

It even says earlier on that by default methods can't be overridden.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
This is correct, methods must be explicitly marked 'Overridable'

Regards

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Raymond Lewallen <Ra******************@nospam.faa.gov> wrote:
I read this on this website page
http://www.vbip.com/books/1861004915...r_4915_06.asp:

Unlike many object-oriented languages, all methods in VB.NET are
virtual.
It's wrong - at least by what I consider the meaning of "virtual" to be
(namely that it can be overridden).

It even says earlier on that by default methods can't be overridden.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #3
So am I correct in my assumption that by default, VB methods are NOT
virtual, which is how I've always understood it?
Jul 21 '05 #4
Raymond Lewallen <Ra******************@nospam.faa.gov> wrote:
So am I correct in my assumption that by default, VB methods are NOT
virtual, which is how I've always understood it?


Yup.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #5
* "Raymond Lewallen" <Ra******************@nospam.faa.gov> scripsit:
So does this mean any method written in VB cannot be inlined, because they
are compiled as virtual? If so, whats the purpose of NotInheritable, or
NotOverridable?
'NotOverridable' is the default. You don't need to explicitly write it
in every method's head.
If someone can point me to someplace that will help me on understanding this
discrepency, I would appreciate it. To this point, I've always understood
that VB.Net methods were not virtual if not declared explicitly as
Overridable, and could therefore have the possibility of being inlined.


You are right -- the author of the text you mentioned is wrong.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #6
> * "Raymond Lewallen" <Ra******************@nospam.faa.gov> scripsit:
So does this mean any method written in VB cannot be inlined, because they are compiled as virtual? If so, whats the purpose of NotInheritable, or
NotOverridable?


'NotOverridable' is the default. You don't need to explicitly write it
in every method's head.


That is wrong. 'NotOverridable' means sealed in C# which is not the default
and must be written explicitly.
'NotOverridable' means a method cannot be overridden even if it is ifself a
virtual method.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Jul 21 '05 #7
> > Unlike many object-oriented languages, all methods in VB.NET are
virtual.

It's wrong - at least by what I consider the meaning of "virtual" to be
(namely that it can be overridden).


The author also claims that
" If all constructor methods of the base class require parameters then we
must implement at least one constructor in our subclass and we must
explicitly call MyBase.New from within our constructors. "

In my knowledge we must provide for each ctor of the baseclass a ctor of the
derived class which then calls the base class ctor.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Jul 21 '05 #8
cody <pl*************************@gmx.de> wrote:
It's wrong - at least by what I consider the meaning of "virtual" to be
(namely that it can be overridden).
The author also claims that
" If all constructor methods of the base class require parameters then we
must implement at least one constructor in our subclass and we must
explicitly call MyBase.New from within our constructors. "


That's true, I believe. Can you give a counter-example? For instance,
can you provide a class with no constructor specified but which derives
from:

public class Foo
{
public Foo (int i)
{
}
}

?
In my knowledge we must provide for each ctor of the baseclass a ctor of the
derived class which then calls the base class ctor.


Not at all. Every constructor in the derived class must call a base
class constructor, but there's nothing to say that you *have* to have
as many derived class constructors as there are base class
constructors.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #9
Cody,

My original post concerned VB, which is what Herfried was referring to, and
he was correct in his post. In VB, NotOverridable is the default. I'm not
sure about C#, as I do 90% of my programming in VB.

Raymond Lewallen
Federal Aviation Administration

"cody" <pl*************************@gmx.de> wrote in message
news:u2**************@tk2msftngp13.phx.gbl...
* "Raymond Lewallen" <Ra******************@nospam.faa.gov> scripsit:
So does this mean any method written in VB cannot be inlined, because they are compiled as virtual? If so, whats the purpose of NotInheritable, or NotOverridable?
'NotOverridable' is the default. You don't need to explicitly write it
in every method's head.


That is wrong. 'NotOverridable' means sealed in C# which is not the

default and must be written explicitly.
'NotOverridable' means a method cannot be overridden even if it is ifself a virtual method.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk

Jul 21 '05 #10
> The author also claims that
" If all constructor methods of the base class require parameters then we
must implement at least one constructor in our subclass and we must
explicitly call MyBase.New from within our constructors. "
This is true. You do have to call a base constructor.
In my knowledge we must provide for each ctor of the baseclass a ctor of the derived class which then calls the base class ctor.


This is not true. You can have only one constructor in your derived class
and many constructors in your base class. You just need to call at least
one of the base constructors.

Raymond Lewallen
Federal Aviation Administration
Jul 21 '05 #11
* "cody" <pl*************************@gmx.de> scripsit:
are compiled as virtual? If so, whats the purpose of NotInheritable, or
NotOverridable?
'NotOverridable' is the default. You don't need to explicitly write it
in every method's head.


That is wrong. 'NotOverridable' means sealed in C# which is not the default
and must be written explicitly.


That's wrong!

In VB.NET, 'NotOverridable' is applied to methods automatically. Just
add a method to a class and take a look at it in object browser.

\\\
Public Class Bar

' Implicitly 'NotOverridable'.
Public Sub Goo()
...
End Sub
End Class

Public Class FooBar
Inherits Bar

' Compile time error:
' Cannot override method that is not marked as 'Overridable' in the base class.
Public Overrides Sub Goo()
...
End Sub
End Class
///
'NotOverridable' means a method cannot be overridden even if it is ifself a
virtual method.


'Overridable' (VB.NET) = 'virtual' (C#). 'NotOverridable' (VB.NET) =
'sealed' (C#) is the opposite of 'Overridable'. 'NotOverridable' is the
default in VB.NET. 'sealed' is not the default in C#.

Making 'NotOverridable' the default has the advantage that the inheritor
cannot override a method to change its behavior if that's not the
intention of the base class' author to allow this. Thus 'Overridable'
must be specified explicitly in VB.NET.

Yes -- there are differences between VB.NET and C#, and I think that the
way the VB.NET team has chosen in this case is the preferred way.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #12
On 2004-08-25, Herfried K. Wagner [MVP] <hi***************@gmx.at> wrote:
* "cody" <pl*************************@gmx.de> scripsit:
are compiled as virtual? If so, whats the purpose of NotInheritable, or
NotOverridable?

'NotOverridable' is the default. You don't need to explicitly write it
in every method's head.
That is wrong. 'NotOverridable' means sealed in C# which is not the default
and must be written explicitly.


That's wrong!


No, it's correct.
In VB.NET, 'NotOverridable' is applied to methods automatically. Just
add a method to a class and take a look at it in object browser.
Or better, look at it in the IL, and you'll see it's not there.

A lot of this is just semantics, but it's still significant. There's a
difference between a method which is "Not Overridable" and the
"NotOverridable" keyword.

By default, VB methods are "not overridable". However, the
NotOverridable keyword does something slightly different and may only be
applied to virtual methods.

'NotOverridable' is the
default in VB.NET.
No, it's not. The default for virtual methods overrides (i.e., with the
Overrides keyword) is Overridable. In fact, try typing

Public Sub Overridable Overrides MyMethod()

and you'll find this out. The compiler specifically says that the
method is implicitly overridable. If you wish to "seal" the virtual
method in a specific subclass, then you must explicitly use the
NotOverridable keyword.

For non-virtual methods, by default they cannot be overridden, but the
NotOverridable keyword simply doesn't apply.
'sealed' is not the default in C#.

Making 'NotOverridable' the default has the advantage that the inheritor
cannot override a method to change its behavior if that's not the
intention of the base class' author to allow this. Thus 'Overridable'
must be specified explicitly in VB.NET.
Just as C# methods must be explicitly virtual, so to VB.Net methods must
be explicitly Overridable. But if you override a method, and wish to
stop subclasses from overriding your implementation, you must be
explicit about this: with NotOverridable in VB.Net and sealed in C#.

Yes -- there are differences between VB.NET and C#, and I think that the
way the VB.NET team has chosen in this case is the preferred way.


There are differences between VB.Net and C#, but this isn't one of them.
Jul 21 '05 #13
Take the following:

Public Class Foo
Public Sub Bar()
End Sub
End Class

Public Class Moo
Inherits Foo
Public Overrides Sub Bar()
End Sub
End Class

It won't compile. You get a build error. 'Bar' overrides a sub in the base
class 'Foo' that is not declared 'Overridable'. It won't compile because
Foo.Bar() is not a virtual method, so back to original question this is all
working as expected. I understand that you can't apply NotOverridalbe to a
method that itself is not a virtual method, but both give the same expected
results... a non-virtual method. So the basic, in-general answer is yes,
all VB.Net methods are non-virtual by default, and only virtual methods can
be made non-virtual using the NotOverridable keyword.
"David" <df*****@woofix.local.dom> wrote in message
news:slrnciqilj.cn4.df*****@woofix.local.dom...
On 2004-08-25, Herfried K. Wagner [MVP] <hi***************@gmx.at> wrote:
* "cody" <pl*************************@gmx.de> scripsit:
> are compiled as virtual? If so, whats the purpose of NotInheritable, or> NotOverridable?

'NotOverridable' is the default. You don't need to explicitly write it in every method's head.

That is wrong. 'NotOverridable' means sealed in C# which is not the default and must be written explicitly.


That's wrong!


No, it's correct.
In VB.NET, 'NotOverridable' is applied to methods automatically. Just
add a method to a class and take a look at it in object browser.


Or better, look at it in the IL, and you'll see it's not there.

A lot of this is just semantics, but it's still significant. There's a
difference between a method which is "Not Overridable" and the
"NotOverridable" keyword.

By default, VB methods are "not overridable". However, the
NotOverridable keyword does something slightly different and may only be
applied to virtual methods.

'NotOverridable' is the
default in VB.NET.


No, it's not. The default for virtual methods overrides (i.e., with the
Overrides keyword) is Overridable. In fact, try typing

Public Sub Overridable Overrides MyMethod()

and you'll find this out. The compiler specifically says that the
method is implicitly overridable. If you wish to "seal" the virtual
method in a specific subclass, then you must explicitly use the
NotOverridable keyword.

For non-virtual methods, by default they cannot be overridden, but the
NotOverridable keyword simply doesn't apply.
'sealed' is not the default in C#.

Making 'NotOverridable' the default has the advantage that the inheritor
cannot override a method to change its behavior if that's not the
intention of the base class' author to allow this. Thus 'Overridable'
must be specified explicitly in VB.NET.


Just as C# methods must be explicitly virtual, so to VB.Net methods must
be explicitly Overridable. But if you override a method, and wish to
stop subclasses from overriding your implementation, you must be
explicit about this: with NotOverridable in VB.Net and sealed in C#.

Yes -- there are differences between VB.NET and C#, and I think that the
way the VB.NET team has chosen in this case is the preferred way.


There are differences between VB.Net and C#, but this isn't one of them.

Jul 21 '05 #14
* "Raymond Lewallen" <Ra******************@nospam.faa.gov> scripsit:
Take the following:

Public Class Foo
Public Sub Bar()
End Sub
End Class

Public Class Moo
Inherits Foo
Public Overrides Sub Bar()
End Sub
End Class

It won't compile. You get a build error. 'Bar' overrides a sub in the base
class 'Foo' that is not declared 'Overridable'. It won't compile because
Foo.Bar() is not a virtual method, so back to original question this is all
working as expected. I understand that you can't apply NotOverridalbe to a
method that itself is not a virtual method, but both give the same expected
results... a non-virtual method. So the basic, in-general answer is yes,
all VB.Net methods are non-virtual by default, and only virtual methods can
be made non-virtual using the NotOverridable keyword.


Great explanation! That's what I was talking about.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #15
* David <df*****@woofix.local.dom> scripsit:
> are compiled as virtual? If so, whats the purpose of NotInheritable, or
> NotOverridable?

'NotOverridable' is the default. You don't need to explicitly write it
in every method's head.

That is wrong. 'NotOverridable' means sealed in C# which is not the default
and must be written explicitly.
That's wrong!


No, it's correct.


It's not correct.

I think we are talking about different things.

What I want to say is that 'NotOverridable' says that a procedure cannot
be overridden by a derived class. 'NotOverridable' is the default for
procedures that do not override a procedure in the base class.
In VB.NET, 'NotOverridable' is applied to methods automatically. Just
add a method to a class and take a look at it in object browser.


Or better, look at it in the IL, and you'll see it's not there.

A lot of this is just semantics, but it's still significant. There's a
difference between a method which is "Not Overridable" and the
"NotOverridable" keyword.


The 'NotOverridable' keyword is overloaded in its meaning. On the one
hand, it's implicitly applied to methods that do not override a
procedure defined in the base class. In this case, you /must not/
specify 'NotOverridable', but it's applied automatically. It's the
default. On the other hand, 'NotOverridable' can be specified to
prevent a base class' method from being overridden in a derived class.
By default, VB methods are "not overridable". However, the
NotOverridable keyword does something slightly different and may only be
applied to virtual methods.
It's implicitly applied to methods that do not override a base class'
method too. That's what the docs say
(<URL:http://msdn.microsoft.com/library/en-us/vblr7/html/vastmsub.asp>).
'NotOverridable' is the
default in VB.NET.


No, it's not. The default for virtual methods overrides (i.e., with the
Overrides keyword) is Overridable. In fact, try typing


Who is talking about overridable methods? This discussion is about the
question if methods in VB.NET can be overridden by default. The answer
is "no".
Public Sub Overridable Overrides MyMethod()

and you'll find this out. The compiler specifically says that the
method is implicitly overridable. If you wish to "seal" the virtual
method in a specific subclass, then you must explicitly use the
NotOverridable keyword.
I never said anything else. I am just talking about something
different.
For non-virtual methods, by default they cannot be overridden, but the
NotOverridable keyword simply doesn't apply.


It does, but implicitly only.
Yes -- there are differences between VB.NET and C#, and I think that the
way the VB.NET team has chosen in this case is the preferred way.


There are differences between VB.Net and C#, but this isn't one of them.


Sorry, I mixed something up. 'virtual' is mandatory to be able to override
a method in C#.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #16
On 2004-08-26, Herfried K. Wagner [MVP] <hi***************@gmx.at> wrote:
* David <df*****@woofix.local.dom> scripsit:
>> are compiled as virtual? If so, whats the purpose of NotInheritable, or
>> NotOverridable?
>
> 'NotOverridable' is the default. You don't need to explicitly write it
> in every method's head.

That is wrong. 'NotOverridable' means sealed in C# which is not the default
and must be written explicitly.

That's wrong!


No, it's correct.


It's not correct.

I think we are talking about different things.

What I want to say is that 'NotOverridable' says that a procedure cannot
be overridden by a derived class. 'NotOverridable' is the default for
procedures that do not override a procedure in the base class.
In VB.NET, 'NotOverridable' is applied to methods automatically. Just
add a method to a class and take a look at it in object browser.


Or better, look at it in the IL, and you'll see it's not there.

A lot of this is just semantics, but it's still significant. There's a
difference between a method which is "Not Overridable" and the
"NotOverridable" keyword.


The 'NotOverridable' keyword is overloaded in its meaning.


As I said originally, some of this is simply semantics. It's a
different model of thinking for the same problem. Since we both agree
that an instance method declared with no modifiers can't be overridden,
the only question is how to best explain that. I think of that as
different than sealed/NotOverridable, while you explain it as
illustrating an overloaded meaning of NotOverridable that may only be
used implicitly.

I don't think there's any final answer here, it's a question of which
explanation is easier to understand, but I prefer my model of
explanation for these reasons:

1. NotOverridable, when used explicitly, has an equivalent in the IL
(final), which does not appear in normal instance methods.

2. I'm coming from more of a c++ background where I immediately think
vtable when I hear virtual. Saying that NotOverridable is the default
makes very little sense in this context.

3. Saying that a keyword has an overloaded meaning that only exists
when used implicitly doesn't really click for me, it seems
contradictory.
By default, VB methods are "not overridable". However, the
NotOverridable keyword does something slightly different and may only be
applied to virtual methods.


It's implicitly applied to methods that do not override a base class'
method too. That's what the docs say
(<URL:http://msdn.microsoft.com/library/en-us/vblr7/html/vastmsub.asp>).


I've seen that. What's interesting is that the C# spec (as well as the
IL documentation) defines the *exact* same concept in a different way.
I presume the documentation folks tested this stuff and found that the
different explanations were more suited to different groups. I suspect
that's related to the vtable thing I mentioned above.
Yes -- there are differences between VB.NET and C#, and I think that the
way the VB.NET team has chosen in this case is the preferred way.


There are differences between VB.Net and C#, but this isn't one of them.


Sorry, I mixed something up. 'virtual' is mandatory to be able to override
a method in C#.


Yes, the two main reasons I posted originally was your "that's wrong!"
in response to a post that had nothing inaccurate in its content at all
seemed likely to confuse people, and your misstatement of the exact same
situation in C# implied that you didn't understand what was going on.

Jul 21 '05 #17
On 2004-08-26, Raymond Lewallen <Ra******************@nospam.faa.gov> wrote:
Take the following:

Public Class Foo
Public Sub Bar()
End Sub
End Class

Public Class Moo
Inherits Foo
Public Overrides Sub Bar()
End Sub
End Class

It won't compile. You get a build error. 'Bar' overrides a sub in the base
class 'Foo' that is not declared 'Overridable'. It won't compile because
Foo.Bar() is not a virtual method, so back to original question this is all
working as expected. I understand that you can't apply NotOverridalbe to a
method that itself is not a virtual method, but both give the same expected
results... a non-virtual method. So the basic, in-general answer is yes,
all VB.Net methods are non-virtual by default, and only virtual methods can
be made non-virtual using the NotOverridable keyword.


Yes, what's kinda funny is that despite all the apparent disagreements
in the last few posts nobody disagrees with the above. I think the only
thing in your original post that was misleading was the statement that
"you don't need to write it [NotOverridable] explictly". This implies
that you *could* write it explicitly on ordinary methods, which of
course you can't.
Jul 21 '05 #18
David,

* David <df*****@woofix.local.dom> scripsit:
In VB.NET, 'NotOverridable' is applied to methods automatically. Just
add a method to a class and take a look at it in object browser.

Or better, look at it in the IL, and you'll see it's not there.

A lot of this is just semantics, but it's still significant. There's a
difference between a method which is "Not Overridable" and the
"NotOverridable" keyword.
The 'NotOverridable' keyword is overloaded in its meaning.


As I said originally, some of this is simply semantics. It's a
different model of thinking for the same problem. Since we both agree
that an instance method declared with no modifiers can't be overridden,
the only question is how to best explain that. I think of that as
different than sealed/NotOverridable, while you explain it as
illustrating an overloaded meaning of NotOverridable that may only be
used implicitly.


ACK.
I don't think there's any final answer here, it's a question of which
explanation is easier to understand, but I prefer my model of
explanation for these reasons:
I never tried to give an explanation that is easy to understand. My
intention was to follow the usage of terminomogy as it's done in the
documentation.
1. NotOverridable, when used explicitly, has an equivalent in the IL
(final), which does not appear in normal instance methods.

2. I'm coming from more of a c++ background where I immediately think
vtable when I hear virtual. Saying that NotOverridable is the default
makes very little sense in this context.

3. Saying that a keyword has an overloaded meaning that only exists
when used implicitly doesn't really click for me, it seems
contradictory.


Well, we are talking about VB.NET. I have stopped using words like
"static", "virtual" and "sealed" some times ago because they only cause
confusion in the context of VB.NET programming. There are other words,
with other semantics. And, I agree with you, 'NotOverridable' maps to
'sealed' in C* semantics, but it doesn't in matters of VB.NET semantics.

It's all just about the fact that VB.NET can stand on its own feet. It
doesn't need to borrow terms from the C* terminology.
It's implicitly applied to methods that do not override a base class'
method too. That's what the docs say
(<URL:http://msdn.microsoft.com/library/en-us/vblr7/html/vastmsub.asp>).


I've seen that. What's interesting is that the C# spec (as well as the
IL documentation) defines the *exact* same concept in a different way.
I presume the documentation folks tested this stuff and found that the
different explanations were more suited to different groups. I suspect
that's related to the vtable thing I mentioned above.


That's what I was thinking about too. My suggestion is to encourage
both groups, VB.NETies and C#ies, to use their own terminology and
making them aware of the fact that there is no 1:1 mapping between them.

It's always interesting to see that different terminology and background
causes confusion :-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #19
* David <df*****@woofix.local.dom> scripsit:
It won't compile. You get a build error. 'Bar' overrides a sub in the base
class 'Foo' that is not declared 'Overridable'. It won't compile because
Foo.Bar() is not a virtual method, so back to original question this is all
working as expected. I understand that you can't apply NotOverridalbe to a
method that itself is not a virtual method, but both give the same expected
results... a non-virtual method. So the basic, in-general answer is yes,
all VB.Net methods are non-virtual by default, and only virtual methods can
be made non-virtual using the NotOverridable keyword.


Yes, what's kinda funny is that despite all the apparent disagreements
in the last few posts nobody disagrees with the above. I think the only
thing in your original post that was misleading was the statement that
"you don't need to write it [NotOverridable] explictly". This implies
that you *could* write it explicitly on ordinary methods, which of
course you can't.


That's indeed weird. I would expect that it was possible to specify
'NotOverridable' in this situation too. The object browser of VB/VS.NET
2002 displays those methods as 'NotOverridable', despite the fact that
'NotOverridable' must not be specified by the programmer in this context.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #20
On 2004-08-26, Herfried K. Wagner [MVP] <hi***************@gmx.at> wrote:

Well, we are talking about VB.NET. I have stopped using words like
"static", "virtual" and "sealed" some times ago because they only cause
confusion in the context of VB.NET programming. There are other words,
with other semantics. And, I agree with you, 'NotOverridable' maps to
'sealed' in C* semantics, but it doesn't in matters of VB.NET semantics.

It's all just about the fact that VB.NET can stand on its own feet. It
doesn't need to borrow terms from the C* terminology.
<rant intensity="medium">

This is actually an area that really annoys me about VB.Net. Words like
virtual and abstract aren't "C#" terms, they're CS terms; they're used
in pretty much every major OO text you'll find, and used to describe
pretty much every OO language out there. I may program in VB.Net these
days, but of the last four programming books I've read, 2 were focused
on java, one on C#, and one was multi-language.

Inventing completely new nomenclature doesn't make these things easier
to learn, it just makes it harder for VB.Net programmers to take
advantage of the vast amount of literature out there.

</rant>
It's implicitly applied to methods that do not override a base class'
method too. That's what the docs say
(<URL:http://msdn.microsoft.com/library/en-us/vblr7/html/vastmsub.asp>).


We've already driven this issue into the ground, but it's interesting
that the actual language spec doesn't back up this part of the
documentation at all...

http://msdn.microsoft.com/library/en...bspec7_1_3.asp

"The NotOverridable modifier indicates that an overridable method cannot
be further overridden"

"NotOverridable cannot be combined with Overridable or MustOverride and
must be combined with Overrides."

Nothing there about anything being NotOverridable by default.

Jul 21 '05 #21

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

Similar topics

32
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
3
by: Danny Din | last post by:
Hi, I have the following code – public class Class1 { public Class1()
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
20
by: Raymond Lewallen | last post by:
I read this on this website page http://www.vbip.com/books/1861004915/chapter_4915_06.asp: Unlike many object-oriented languages, all methods in VB.NET are virtual. Now in BOL, Under...
4
by: Stefan Nikolaus | last post by:
Hello, I've run into problems with defining a template, which inherits from a base template and the usage of virtual methods in those. I want to initialize a member variable depending on which...
318
by: King Raz | last post by:
The shootout site has benchmarks comparing different languages. It includes C# Mono vs Java but not C# .NET vs Java. So I went through all the benchmark on the site ... ...
2
by: fgh.vbn.rty | last post by:
Hi, I'm not sure if i'm asking the question correctly but anyway here it is. Say I have 3 classes - class A, class B, class R. 1) A and B are the building blocks and R is like a repository...
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.