Z
ZenRhapsody
Are ALL methods in subclasses implemented in C# with vtables and virtual
functions?
I know I could test this myself, but I'm still using Express edition of 2.0,
so I cannot view the optimized disassembly.
I know that you must use vtables for all virtual functions (and interfaces),
but if there are non-virtual functions, does the compiler use a vtable for
everything anyway?
For example, if I have a base class like this:
class baseClass
{ protected variables list......
public void A(){}
public void B(){}
public abstract void C(){}
}
class sub1 : baseClass
{ public override void C(){}
public void D(){}
}
class sub2 : baseClass
{ public override void C(){}
public void E(){}
}
Will the compiler create a full vtable for all of sub2's methods (including
inherited ones)? Or, will it compile in direct addresses (and allow inline
compile for short methods) for functions A(), B(), E() ? (and it could
possibly do C() also). IMO, the only real vtable required would be if you
access sub2 through a variable of type baseClass.
I'm just trying to fully understand this compiler - any insight is
appreciated.
functions?
I know I could test this myself, but I'm still using Express edition of 2.0,
so I cannot view the optimized disassembly.
I know that you must use vtables for all virtual functions (and interfaces),
but if there are non-virtual functions, does the compiler use a vtable for
everything anyway?
For example, if I have a base class like this:
class baseClass
{ protected variables list......
public void A(){}
public void B(){}
public abstract void C(){}
}
class sub1 : baseClass
{ public override void C(){}
public void D(){}
}
class sub2 : baseClass
{ public override void C(){}
public void E(){}
}
Will the compiler create a full vtable for all of sub2's methods (including
inherited ones)? Or, will it compile in direct addresses (and allow inline
compile for short methods) for functions A(), B(), E() ? (and it could
possibly do C() also). IMO, the only real vtable required would be if you
access sub2 through a variable of type baseClass.
I'm just trying to fully understand this compiler - any insight is
appreciated.