Class Inheritance


#1

Looking at http://chaiscript.com/docs/5/LangObjectSystemRef.html It doesn’t mention inheritance at all. Am I correct to assume object inheritance is not supported? I am not asking about inheriting a class defined in c++, just plain script/script inheritance.

class Base  {  attr ID;  };
class Derive { ?? }

Is there a language construct allowing me to have ID attribute in objects of Derive class (apart from just adding attr ID ).

Thanks again!


#2

No, that has not been implemented…

It might not actually be terribly difficult to implement. I’d have to think about it. Feel free to create a feature request on the github issue tracker with a proposed syntax: https://github.com/ChaiScript/ChaiScript/issues


#3

I will do that, thanks!


#4

Was looking to add an overriden function with an inherited class, and discovered I had to let ChaiScript know about the inheritance…

chai.add(chaiscript::base_class<Base, Derived>());