Re: HashMap get/put
Peter Duniho wrote:
Mike Schilling wrote:
Peter Duniho wrote:
I think I see the disconnect here. I'm talking about the eventual
native code being executed. When possible (i.e. in C# for methods
that aren't explicitly marked as "virtual"), static calls are
generated, and thus they are non-virtual. But yes, you're
right...that's not really accurate, since the language itself
doesn't
make the distinction in the _implementation_.
The C# compiler can create two completely different kiinds of code
for mwthods that are not declared virtual. Consider the following
file: namespace Test
{
interface IFace
{
void Doit();
}
class Virtual : IFace
{
public void Doit()
{
}
public void DoitNow()
{
}
}
}
DoitNow is generated as a non-virtual method.
Well, you are using the same semantics I am. But as I pointed out,
there's room for confusion here.
A call to DoitNow() still generates a "callvirt" MSIL instruction
(similar to the Java approach).
If you look at the method properties using ildasm, you'll see:
public hidebysig newslot virtual final instance void Doit() cil managed
vs.
..public hidebysig instance void DoitNow() cil managed
One has a slot in the virtual table, and one does not.