Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Derived class in Python not being called by C# #1107

Open
@jeffzi19

Description

@jeffzi19

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp