-
-
Save fowlmouth/74bd31089c0cd3545f26 to your computer and use it in GitHub Desktop.
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
type MyObj = ref object of RootObj | |
method output(self: MyObj) = | |
echo "Output something" | |
type ChildObj = ref object of MyObj | |
customvar: string | |
method newOutput(self: ChildObj) = | |
self.customvar = "Child output custom var too" | |
method output(self: ChildObj) = | |
echo "Child Output something too" | |
self.newOutput() | |
echo self.customvar | |
var o = MyObj() | |
var ochild = ChildObj() | |
var objs : seq[MyObj] = @[] | |
objs.add(o) | |
objs.add(ochild) | |
for o in objs: | |
o.output() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment