Deriving a D-class from a CPP-class

Alain De Vos devosalain at ymail.com
Wed Apr 28 17:54:03 UTC 2021


Is it ok to do the following ?
I.e. derive  a D-class from a CPP-class.
The compiler did not complained, and it was OK for him.
```
c++ -c MyClass.cpp
ldc2 main.d MyClass.o -L-lstdc++
```

```
extern(C++){
	class MyClass {
		public:
			int num=1;
			void myMethod();
	};
};

class Derived : MyClass{
};

int main(){
	Derived myObj;
	myObj.myMethod();
	return 0;
}

```

Could I use this method for using the C++-WXWIDGETS library 
directly?


More information about the Digitalmars-d-learn mailing list