Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classes? #591

Open
ethindp opened this issue Mar 13, 2022 · 2 comments
Open

Classes? #591

ethindp opened this issue Mar 13, 2022 · 2 comments

Comments

@ethindp
Copy link

ethindp commented Mar 13, 2022

Does ChaiScript support classes in the language itself (not on the C++ side) with their or both single-and multiple inheritance?

@RobLoach
Copy link
Contributor

class Rectangle {
  attr height
  attr width
  def Rectangle() { this.height = 10; this.width = 20 }
  def area() { this.height * this.width }
}

@ethindp
Copy link
Author

ethindp commented Mar 13, 2022

@RobLoach Thanks! The Cheat sheet doesn't document this syntax and I can't seem to find any kind of BNF/EBNF/ABNF grammar for the language. Could I extract the class dynamically in C++? E.g.: I declare a class Thing, then I inherit an object from Thing (all in Chaiscript), then in C++ I want to extract a dynamic object and search for a particular method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants