- Notifications
You must be signed in to change notification settings - Fork750
Description
Hello - this is my first post so apologies if this is the wrong forum.
I'm trying to define a base class in C# and derive from that class in python / pythonnet. The C# class is very basic:
publicclassOrder{publicstringsymbol;publicvirtualvoidEvaluate(Barb){Console.WriteLine("from Order.Evaluate() - hello!");}}
In python I have the specific order class defined as:
classLimitOrder(Order):def__init__(self):self.symbol="SQ"defEvaluate(self,bar ):print("LimitOrder.Evaluate() - yay python!" )
In C# I have an OMS class with a method:public void AddOrder( Order order )
When I pass inLimitOrder
and call a method in the OMS that callsEvaluate
, theOrder
classEvaluate
method is called instead of theLimitOrder.Evaluate
method.
I'm using python 3.6.7 and VS 2019 / .NET 4.7.2
In searching for this I'm only seeing 1 instance of a similar question being asked but no solid response. TheEvaluate()
method (and entireOrder
class for that matter) can be abstract but when I try that I get an error creating theLimitOrder
object saying I can't create an abstract class.
Any help would be appreciated. Thanks in advance.