mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-05-01 03:19:28 +08:00
* Fix #201: Add class inheritance support with Derived : Base syntax Classes can now inherit methods and attributes from a base class using C++-style syntax: `class Derived : Base { ... }`. Base class methods and attributes are automatically available on derived objects. Derived classes can override base methods by defining a method with the same name. Inheritance relationships are tracked to support proper type matching in the dispatch system. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address review: use implicit derived-to-base matching instead of copying base class functions Instead of copying all base class methods/attributes into derived classes, make the type matching system recognize inheritance relationships. Base class methods now naturally match derived objects through dynamic_object_typename_match, and dispatch ordering ensures derived overrides are preferred over base methods. This is simpler (net -25 lines) and avoids duplicating function registrations. Requested by @lefticus in PR #641 review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add tests for passing derived objects to functions expecting Base Tests cover: free functions calling base methods on derived objects, polymorphic dispatch through containers, base attribute access on derived objects, and multi-level inheritance (GrandChild : Derived : Base). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add typed parameter tests for class inheritance Use typed function signatures (e.g., `def call_do_something(Base obj)`) instead of untyped parameters to test that derived objects are accepted by functions expecting a base type, with correct polymorphic dispatch. Requested by @lefticus in PR #641 review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: leftibot <leftibot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| any.hpp | ||
| bad_boxed_cast.hpp | ||
| bind_first.hpp | ||
| bootstrap_stl.hpp | ||
| bootstrap.hpp | ||
| boxed_cast_helper.hpp | ||
| boxed_cast.hpp | ||
| boxed_number.hpp | ||
| boxed_value.hpp | ||
| callable_traits.hpp | ||
| dispatchkit.hpp | ||
| dynamic_object_detail.hpp | ||
| dynamic_object.hpp | ||
| exception_specification.hpp | ||
| function_call_detail.hpp | ||
| function_call.hpp | ||
| function_params.hpp | ||
| function_signature.hpp | ||
| handle_return.hpp | ||
| operators.hpp | ||
| proxy_constructors.hpp | ||
| proxy_functions_detail.hpp | ||
| proxy_functions.hpp | ||
| register_function.hpp | ||
| short_alloc.hpp | ||
| type_conversions.hpp | ||
| type_info.hpp | ||