Added 'new_class' instead of 'new' for the macro.

This commit is contained in:
Joey Payne 2015-05-14 18:19:59 -06:00
commit 321be06f40
2 changed files with 95 additions and 20 deletions

View file

@ -6,9 +6,13 @@ These extensions aim to improve the usability of nim in practical applications.
Extensions so far include:
## OOP macro
This module was modified from the OOP section on the excellent website http://nim-by-example.github.io/
usage:
```nim
import oop_macro
class BaseObject: # inherits from RootObj
# attributes/properties
var
@ -26,3 +30,8 @@ Extensions so far include:
method override_me(argx: float): int=
result = int(self.y) + int(argx) + self.x
```
There's also an example in the code that demonstrates the inheritance that can be run by executing:
```bash
nim c -r oop_macro.nim
```