« Return to Thread: mapping c++ abstract class to c# Interface

mapping c++ abstract class to c# Interface

by stefano ruberto :: Rate this Message:

Reply to Author | View in Thread

Hi there...

The problem "... Multiple inheritance is not supported in C#."


In order to translate multiple inheritance into c#  I think would be
usefull to use the c# interface.

SWIG only take the first base class in my c++ code but anyway insert the
inherited method from all
the base class in the cs proxy class...

So I tought to add a c# interface for each abstract  c++ base class.

//c++ side
class abstarctCppBase1{ void mth1Base1()=0 ;  void mth2Base1(){}  ... }

class abstarctCppBase2{  void mth1Base2()=0 ; void mth2Base1() {}...}

class CppInherited : abstarctCppBase1 , abstarctCppBase2
{ }

//c# side


interface Ibase2 {  mth1Base2();  mth2Base1(); }

class csBase1{  ... }

class csInherited : csBase1, Ibase2 { void mth1Base1(){}   void
mth2Base1(){} void mth1Base2(){} void mth2Base1() {} }

Is this the correct way ... ??
I'm so new to swig so that any help will be appreciated!

Thank you for your help
By
Rubio





-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

 « Return to Thread: mapping c++ abstract class to c# Interface

LightInTheBox - Buy quality products at wholesale price