Composition and Inheritance of Wrapped Objects Examples
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Dokumentation
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- cpp, nodejs
- Bereich
- documentation
Rechercherichtung
Read the existing 6_object_wrap/node-addon-api example and the inherits_from_event_emitter/node-addon-api example first, including their build files and JavaScript usage. Add focused examples covering composition and inheritance of ObjectWrap-based C++ classes, with each class independently instantiable from JavaScript, and verify the examples build and run.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Can examples of composition and inheritance of wrapped objects be added? I think one could potentially figure it out with the current examples, but I'm not able to figure it out.
class BasicClass { int IntValue; };
class BasicComposition
{
int foo;
BasicClass bc;
};
class BasicInheritance : BasicClass
{
double yValue;
};
class InheritanceAndComposition : BasicInheritance
{
std::string strValue;
BasicComposition bcValue;
};
// Export all classes to JS
One should be able to instantiate and use each C++ class in JavaScript (e.g. create an instance of BasicClass independent of instances of BasicComposition).
It seems to me that only the case of BasicClass has an example in 6_object_wrap. The other cases with inheritance and composition of classes extending ObjectWrap<T> do not appear to exist. Inheritance might be covered in inherits_from_event_emitter, but it is not clear to me what is going on in that example.
I'm hoping someone with more experience with node-addon-api can provide these types of examples. It would greatly assist me in defining more complex relationships in Napi.
- Vorherrschende Sprache
- C++
- Sterne
- 2.6k
- Forks
- 602
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus nodejs/node-addon-examples
-
enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 38/100
nodejs/node-addon-examples#585 · 1 Reaktion ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 38/100
nodejs/node-addon-examples#530 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
nodejs/node-addon-examples#445 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 32/100
nodejs/node-addon-examples#444 · 1 Kommentar ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
nodejs/node-addon-examples#381 ·
Alle Issues in nodejs/node-addon-examples
Ähnliche Issues
-
Website Doc Typo Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 92/100
autowarefoundation/autoware_universe#13413 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
automated-analysis bug memory-safety
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100