Just for completeness:

- VB.NET is *not* virtual by default
- "Overloads" is the C# equivalent to "new" in C# (not Overrides like my
example showed)
- "Overridable" is the VB.NET equivalent to "virtual" in C#
- "Overrides" is the VB.NET equivalent to "override" in C#

So nevermind...my confusion what that the CodeDOM's VB Code Generator in 1.x
created "overridable" functions, subs and properties by default (unlike the
C# which created non-virtual by default)...not that VB.NET was virtual by
default...my bad memory.

Thanks,

Shawn Wildermuth
Wildermuth Consulting Services, LLC
http://adoguy.com
C# MVP, MCSD.NET, Author and Speaker


> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Shawn Wildermuth
> Sent: Friday, July 07, 2006 10:22 PM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] Virtual methods in .NET - was
> Implementing an Interface - C# vs. VB.NET
>
> This is how I tested it:
>
> Module Module1
>
>   Sub Main()
>
>     Dim test As T = New X
>     test.Run()
>
>     Console.Read()
>
>   End Sub
>
> End Module
>
> Class T
>   Public Sub Run()
>
>     Console.WriteLine("T.Run()")
>
>   End Sub
>
> End Class
>
> Class X
>   Inherits T
>
>   Public Overloads Sub Run()
>
>     Console.WriteLine("X.Run()")
>
>   End Sub
>
>
> End Class
>
> When I ran this code, the console wrote out:
>
> T.Run()
>
> This leads me to believe that Sub Run is virtual by default, no?
>
> Thanks,
>
> Shawn Wildermuth
> Wildermuth Consulting Services, LLC
> http://adoguy.com
> C# MVP, MCSD.NET, Author and Speaker
>
>
> > -----Original Message-----
> > From: Discussion of advanced .NET topics.
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> Barry Kelly
> > Sent: Friday, July 07, 2006 10:12 PM
> > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> > Subject: Re: [ADVANCED-DOTNET] Virtual methods in .NET - was
> > Implementing an Interface - C# vs. VB.NET
> >
> > I just tried it with a simple file:
> >
> > Imports System
> >
> > Public Class App
> >
> >     Shared Sub Main()
> >         Console.WriteLine("Hello World")
> >     End Sub
> >
> >     Public Sub Foo()
> >     End Sub
> >
> > End Class
> >
> > And peeked in .NET Reflector. I may have done something wrong
> > - I'm a complete novice in VB.NET.
> >
> > -- Barry
>
> ===================================
> This list is hosted by DevelopMentor.  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to