I want to create a position type:
And then add it to a sprite type like so:
I want to then be able to access it like so:
ThisSprite.X =
ThisSprite.Handle.X =
But I don't want the sprite type to say "Extends Position" because that's just silly from an object point of view, and it does not help me if I have a bunch of different types that I want to include as fields in this way.
Obviously I could do this:
But that would defeat the purpouse of having a position type that contains X and Y to make things nice and clean.
Of course, this might not be a great idea after all because if I extend position later to have X Y and Z, I obviously don't want to extend the handle in the same way, so mayble I shouldn't do it, but I'm still curious to know if this is possible and how to do it.
Also, is is possible for me to have types in an include file that cannot be accessed outside the include file?
Like something local to the include, but global within the include so all the functions in the include file can access it? Or do I have to use something other than an include to do this?
The reason I want to do that, is because if I were to have a Position type, that could collide with someone else's position type in their main program. But at the same time I would rather not have to have SSS_ on the front of every type and global variable I need in my system to try to ensure no collisions.
Type Position Field X#, Y# End Type
And then add it to a sprite type like so:
Type Sprite ??? Field Handle:Position EndType
I want to then be able to access it like so:
ThisSprite.X =
ThisSprite.Handle.X =
But I don't want the sprite type to say "Extends Position" because that's just silly from an object point of view, and it does not help me if I have a bunch of different types that I want to include as fields in this way.
Obviously I could do this:
Type Sprite Field X#, Y# Field Handle:Position EndType
But that would defeat the purpouse of having a position type that contains X and Y to make things nice and clean.
Of course, this might not be a great idea after all because if I extend position later to have X Y and Z, I obviously don't want to extend the handle in the same way, so mayble I shouldn't do it, but I'm still curious to know if this is possible and how to do it.
Also, is is possible for me to have types in an include file that cannot be accessed outside the include file?
Like something local to the include, but global within the include so all the functions in the include file can access it? Or do I have to use something other than an include to do this?
The reason I want to do that, is because if I were to have a Position type, that could collide with someone else's position type in their main program. But at the same time I would rather not have to have SSS_ on the front of every type and global variable I need in my system to try to ensure no collisions.