Hi folks,

On the IL level there are various call* instructions like call, callvirt and
calli. The former two are the ones which interest us most in this
discussion. As you probably know, a virtual call has a level of indirection
through a so-called v-table structure ("method table"), which makes such a
call more expensive. If you need more information on this, drop a follow-up
mail or browse the internet or the CLI spec.

As Tony pointed out, Anders Hejlsberg has pointed out the reasons for the
choice of non-virtual by default on
http://www.artima.com/intv/nonvirtual.html. Performance and versioning are
the main reasons as pointed out by Anders.

-Bart

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Tony Nassar
Sent: zondag 25 februari 2007 4:26
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] Virtual methods in .NET - was Implementing an
Interface - C# vs. VB.NET

Assuming your question isn't simply rhetorical, the reason is very simple:
the CLS didn't make it its business to force *every* language to be like
Java in this respect. Anders Hjellberg has explained exactly why C# is this
way; check out the interviews with him at artima.com.

> Anybody know why methods aren't virtual by default in .NET?
> It seems like a really bad default to have all methods non-virtual.

===================================
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