[IronPython] C# code calling IP subclass weirdness

Michael Shilman shilman at microsoft.com
Mon Nov 14 22:41:52 CET 2005

Doh.  I introduced a bug when reducing my complex actual bug to this toy
example.  I added "virtual" to the C# program where it should have been,
and now it works fine.  

Now I need to figure out where things are going awry in my actual
example, where things are a bit more complicated (and the method I care
about *is* marked virtual, but still does not get called properly!).

Thanks, and sorry for the false alarm.


-----Original Message-----
From: msurel at comcast.net [mailto:msurel at comcast.net] 
Sent: Monday, November 14, 2005 11:58 AM
To: Discussion of IronPython; Discussion of IronPython
Cc: Michael Shilman
Subject: Re: [IronPython] C# code calling IP subclass weirdness

In C#, if you want somebody to be able to override a method in a base
class, I think you need the virtual keyword. I believe if you define the
DoSomething method in Helper with the virtual keyword, then you should
be ok.

That would be about the only suggestion I have. Other than that, the
code looks ok to me. In C# if you want to override a method in a base
class I believe it has to be declared virtual and the method in the
subclass needs to have the override keyword.

Since you don't have the equivalent of the 'override' keyword in Python,
I'm not 100% sure you will be able to do this anyway.

> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

More information about the Ironpython-users mailing list