[Mono-dev] [Mono Embed]How can I implement an abstract class of C++ in C#?

xoyojank xoyojank at gmail.com
Tue Jan 10 04:43:30 UTC 2012


I have embeded mono as script engine, and now I want to implent C++ abstract
interface in C#.
C++:
class A
{
    int testInt;
public:
    A()
    {
        testInt = 1234;
    }
    virtual void Test() = 0;

    // how to register template method?
    template<typename T>
    void TestTemplate(T value);
}

void main()
{
    // how to register the internal calls?
    A* a = mono_object_new(mono_domain_get(), classB);
    a->Test();
}

C#:
// how to declare abstract class A?
// how to declare template method?

class B : public A
{
    virtual void Test()
    {
        Console.WriteLine(this.testInt);// how to access the "testInt" of A?
    }
} 

--
View this message in context: http://mono.1490590.n4.nabble.com/Mono-Embed-How-can-I-implement-an-abstract-class-of-C-in-C-tp4281121p4281121.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list