Last active
May 5, 2018 19:43
-
-
Save sherjilozair/e289e46961169d1b883b1c93a81965f4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #include "animal.h" | |
| void Animal::inc(int i){ | |
| this->counter += i; | |
| } | |
| void Animal::say(){ | |
| std::cout << this->counter << std::endl; | |
| } |
This file contains hidden or 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
| #include <iostream> | |
| class Animal | |
| { | |
| public: | |
| int counter; | |
| void inc(int); | |
| void say(); | |
| }; |
This file contains hidden or 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
| main.nim(14) main | |
| SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
This file contains hidden or 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
| {.compile: "/Users/sherjilozair/NimProjects/nim-sfml/animal.cpp".} | |
| const header = "/Users/sherjilozair/NimProjects/nim-sfml/animal.h" | |
| type | |
| AnimalObj {.header: header, importcpp: "Animal".} = object | |
| Animal = ptr AnimalObj | |
| proc say(animal: Animal) {.importcpp: "#.say(@)".} | |
| proc inc(animal: Animal, i: cint) {.importcpp: "#.inc(@)".} | |
| when isMainModule: | |
| var x: Animal | |
| x.say() | |
| x.inc(10) | |
| x.say() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment