-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to represent C++ object inheritance as Java object inheritance using HybridClass
?
#96
Comments
mrousavy
changed the title
How to build a proper
How to represent C++ object inheritance as Java object inheritance using Aug 16, 2024
HybridClass
inheritance?HybridClass
?
cc @passy, maybe you know the answer to this :) |
I think what I want is to use virtual inheritance to avoid having class JCar : public HybridClass<JCar>, virtual public Car;
class JSportsCar : public HybridClass<JSportsCar, JCar>, virtual public SportsCar; But I can't seem to properly construct that hybrid object then: - Constructor inherited by 'HybridClass<JSportsCar, JCar>' from base class 'JCar' is implicitly deleted 🤔 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey all! I've been using fbjni in a lot of libraries now, and now I stumbled upon an interesting task.
I have pure, shared C++ classes that define virtual methods. E.g.
Car
, andSportsCar
which inherits fromCar
, overrides a few methods and adds some methods.I want to resemble that C++ inheritance in Java, without adding something to those C++ classes (they are shared between platforms).
So my understanding is that I create the same types in Java:
..and then how do I properly bridge them to C++ using fbjni? Can my fbjni class inherit from both the Java base, and the SportsCar base?
Can I call
initHybrid()
in both base and inherited class? Do I now have two base instances of the same type (Car
) in memory?The text was updated successfully, but these errors were encountered: