I'm writing a GUI module ( think I mentioned this already, but just in case ) and I'm thinking that I can save a lot of code and make things more readable by having a base gadget type and extending it for each specific gadget type.
The thing is, the gadgets rely on a bunch of type-globals. Things like the texture they draw from, I can't have those as a field instead. But if they're globals, I can't inherit them because then I end up with one for all gadget types, when what I need is one for *each* gadget type ( and *not* one for each gadget instance! )
Now that's ok as far as it goes, but I find that a lot of my methods are using those globals in some shape or form, which means that I can't inherit any of those methods either. It's ending up so that about half the stuff which every gadget has in common can't be done through inheritance because it uses one or more globals. It's a royal pain.
Now I'm fairly new to OO programming, so is it my way of thinking that's wrong? How should I be thinking? Is it someting which BMax does not have which other OO languages do have? Is there another way of achieving the same thing?
It seems ( to an OO newbie like myself ) that being able to mark Globals as abstract so that the inherited methods know that they exist but doesn't implement them would be a good solution, but there are probably good reasons for this not being possible.
Anyway, any thoughts?
The thing is, the gadgets rely on a bunch of type-globals. Things like the texture they draw from, I can't have those as a field instead. But if they're globals, I can't inherit them because then I end up with one for all gadget types, when what I need is one for *each* gadget type ( and *not* one for each gadget instance! )
Now that's ok as far as it goes, but I find that a lot of my methods are using those globals in some shape or form, which means that I can't inherit any of those methods either. It's ending up so that about half the stuff which every gadget has in common can't be done through inheritance because it uses one or more globals. It's a royal pain.
Now I'm fairly new to OO programming, so is it my way of thinking that's wrong? How should I be thinking? Is it someting which BMax does not have which other OO languages do have? Is there another way of achieving the same thing?
It seems ( to an OO newbie like myself ) that being able to mark Globals as abstract so that the inherited methods know that they exist but doesn't implement them would be a good solution, but there are probably good reasons for this not being possible.
Anyway, any thoughts?