Problems with subclasses...
Hi list, Sorry if this is posted twice, however I didn't see this message on the list. Maybe the company mailserver hasn't delievered it :( I got a problem here. I have the a class in .NET1.1 (Class A) with the method public virtual void Do() for example. Another .NET class (say Class B) has a collection of Class A and a method DoAll() which iterates over all Class A in B and calls the Do() Method. So now comes the problem. In Python I have a class MyA derived from .NET Class A and overrides the method Do(). Now I add some of my MyA class to the B class and execute DoAll() on B. Surprisingly, only the Do() methods of A are called not the PythonNet Do() in the MyA instances. I would have expected that the MyA.Do() will be called. Is this a bug? I'm using the RC2 of PythonNet for .NET1.1 and Python2.4.2. Any ideas? Markus
Hi Markus - a limitation of Python for .NET is that overrides you write in Python are only visible to Python code. There is some possibility that in the future we could generate a .NET subclass whenever you subclass in Python and provide delegate implementations of overridden methods that would be visible to .NET, but that does not currently exist. -Brian ________________________________ From: pythondotnet-bounces@python.org on behalf of Markus Schumacher Sent: Fri 5/26/2006 10:28 AM To: pythondotnet@python.org Subject: [Python.NET] Problems with subclasses... Hi list, Sorry if this is posted twice, however I didn't see this message on the list. Maybe the company mailserver hasn't delievered it :( I got a problem here. I have the a class in .NET1.1 (Class A) with the method public virtual void Do() for example. Another .NET class (say Class B) has a collection of Class A and a method DoAll() which iterates over all Class A in B and calls the Do() Method. So now comes the problem. In Python I have a class MyA derived from .NET Class A and overrides the method Do(). Now I add some of my MyA class to the B class and execute DoAll() on B. Surprisingly, only the Do() methods of A are called not the PythonNet Do() in the MyA instances. I would have expected that the MyA.Do() will be called. Is this a bug? I'm using the RC2 of PythonNet for .NET1.1 and Python2.4.2. Any ideas? Markus _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
participants (2)
-
Brian Lloyd
-
Markus Schumacher