From bb08cc3699635a8448f6eec74e732cf3a4eb4ebb Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sun, 31 Aug 2014 19:54:43 -0600 Subject: [PATCH] Add documenation for "class" keyword --- include/chaiscript/chaiscript.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/chaiscript/chaiscript.hpp b/include/chaiscript/chaiscript.hpp index 903eb38..d541365 100644 --- a/include/chaiscript/chaiscript.hpp +++ b/include/chaiscript/chaiscript.hpp @@ -497,6 +497,21 @@ /// print(rect.area()) /// ~~~~~~~~~ /// +/// Since ChaiScript 5.4.0 it has been possible to use the "class" keyword to simplify this code. +/// +/// ~~~~~~~~~ +/// class Rectangle { +/// attr height +/// attr width +/// def Rectangle() { this.height = 10; this.width = 20 } +/// def area() { this.height * this.width } +/// } +/// +/// var rect = Rectangle() +/// rect.height = 30 +/// print(rect.area()) +/// ~~~~~~~~~ +/// /// @sa @ref keywordattr /// @sa @ref keyworddef