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> |
||
|---|---|---|
| .. | ||
| chaiscript_algebraic.hpp | ||
| chaiscript_common.hpp | ||
| chaiscript_engine.hpp | ||
| chaiscript_eval.hpp | ||
| chaiscript_optimizer.hpp | ||
| chaiscript_parser.hpp | ||
| chaiscript_posix.hpp | ||
| chaiscript_prelude_docs.hpp | ||
| chaiscript_prelude.hpp | ||
| chaiscript_tracer.hpp | ||
| chaiscript_unknown.hpp | ||
| chaiscript_windows.hpp | ||