In C++
class A{
..
..
}
class B{
..
..
}
Now in java I am able to generate A.java, B.java classes. Now I want in java A to extend B. So I used %typemap(javabase) A "B". I can see that A extends B in A.java
Now I don't have default constructor in class B. So in generated A.java I am getting error
"implicit super constructor B() is undefined."
If I add manually super to the generated constructor of A everything will works. But I don't want to edit A.java.
Using swig typemaps can I generate the constructor for A which will call super constructor?
%typemap(javabody) A %{
private long swigCPtr;
protected boolean swigCMemOwn;
protected $javaclassname(long cPtr, boolean cMemoryOwn) {
super(cPtr,cMemoryOwn);
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
%}
Solved the problem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.