Composition and Inheritance of Wrapped Objects Examples
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cpp, nodejs
- Lĩnh vực
- documentation
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C++
- Star
- 2.6k
- Fork
- 602
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodejs/node-addon-examples
-
Create Valgrind run of tests Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
nodejs/node-addon-examples#585 · 1 reaction ·
-
Add .d.ts files in samples. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
nodejs/node-addon-examples#530 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
nodejs/node-addon-examples#445 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 32/100
nodejs/node-addon-examples#444 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
nodejs/node-addon-examples#381 ·
Tất cả issue của nodejs/node-addon-examples
Issue tương tự
-
Website Doc Typo Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
autowarefoundation/autoware_universe#13413 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
automated-analysis bug memory-safety
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100