Created
May 24, 2021 22:38
-
-
Save germandiagogomez/7557bd1c69c39247dd6980009057e164 to your computer and use it in GitHub Desktop.
Class in ChaiScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameView { | |
var playerNumber | |
var cppView | |
def GameView(playerNumber) { | |
// Uses copy constructor | |
playerNumber = playerNumber | |
// does not use copy constructor | |
cppView := createGameView("MatchView") | |
} | |
def someFunction(parameter) { | |
// Parameter can be printed via a "to_string" function | |
print("Hello ${parameter}") | |
} | |
} | |
auto myView = GameView(2) | |
myView.someFunction(MyPrintableClass()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment