Skip to content
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 map the inheritance relationship of C ++ classes to JavaScript #956

Closed
ApsarasX opened this issue Mar 29, 2021 · 5 comments
Closed
Labels

Comments

@ApsarasX
Copy link

I went over the issue about inheritance #229, have not found a valid way to implement inheritance.

It is 2021 now. What's the progress of node-addon-api supporting inheritance?

I would appreciate it if I could get a direct solution

@ApsarasX
Copy link
Author

My C++ code

class Base {
    void print() {
        cout << "Base::print" << endl;
    }
};

class Derived : public Base {
    
};

My JavaScript Code

let derived = new Derived();

derived.print();

What I expect

Base::print

What actually happened

TypeError: Illegal invocation

@sambhavsaxena
Copy link

NewDerived extends from Derived(); derived.print();

This is the correct syntax i guess

@ApsarasX
Copy link
Author

NewDerived extends from Derived(); derived.print();

This is the correct syntax i guess

@sambhavsaxena sorry, you guessed wrong😂

@github-actions
Copy link
Contributor

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

@github-actions github-actions bot added the stale label Aug 29, 2021
@ApsarasX
Copy link
Author

Is there any progress on this issue now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants