inheritance problem
BlitzMax Forums/BlitzMax Beginners Area/inheritance problem
| ||
I'm having a little problem with inheritance. The way i see it, my enemy2 type over rides the updatePosition method, but when i have an object of type enemy and enemy2 there is some strange behavior. Can you see what i'm doing wrong Cheers Charlie |
| ||
rename global to field. Otherwise all instances of enemy and enemy2 only have 1 single version of each of those. |
| ||
ok, thanks. i was using global because i didn't want to be able to access the attributes outside of the type. can i still do this with field? i can't seem to make them private Cheers Charlie |
| ||
you can't make fields and methods private/public as far as I know, I'd like to be wrong on this. |
| ||
Nope, sadly you are right GA. all information are public. If you don't want to make them public, then check the faq section, the first thread in there shows how to do it. BUT: This will it make impossible to extend your types ... (as the implementation is the private part and thus can't be extended) |
| ||
thanks Dreamora. It would be useful to have private just so users of my Types don't try calling internal methods... |
| ||
You can try renaming all your private stuff with an underscore at the beginning. Works as a good reminder. |
| ||
Thanks, I guess the same could be applied to methods too. |
| ||
That or simply not documenting it. There is no IDE so far that is able to parse the .i files to show undocumented stuff on a precompiled library. (and even if, you could still remove it from there, if it is not used from outside anyway) |
| ||
I haven't got as far as documentation ... :-/ |