[Mono-list] Base class casting weirdness

Dominic Cooney dominic@dcooney.com
Fri, 18 Jan 2002 05:39:06 +1000


> CSC will compile it, but you'll get a StackOverflowException at 
> runtime. Why would I want to write it this way instead of using 
> 'base'? Well, I've got a class C derived from B, that wants to 
> implement Foo by invoking A's definition. Can anyone think of a way to

> do this? Is the runtime exception correct, or is this an SDK bug? And 
> what does MCS/Mono do with this?

Mark,

In terms of your problem (invoking A::Foo for C::Foo) you can hack the
IL so the body of C::Foo is:

	ldarg.0
	tail.call string A::Foo()

Sincerely,

Dominic Cooney