- Joined
- Oct 12, 2008
- Messages
- 1,570
I have two simple questions.
I know OOP from C++, but I've never heard the word "enrichment" when reading or hearing about OOP, what do you mean by it?
And you also mention generic, does this mean templates? Templates is a difficult subject to implement. I'm skeptic about this project, but I hope it'll work out
Also, I've never used Java or studied any of it, but I've heard it lacks speed. If this is true, then don't you think it's a problem?
How I see enrichment is this: (But I am just a simple mind, with close to zero knowledge of coding)
You can see every type in Galaxy as a class. We cannot acces it's members directly, only through functions..
Now an enrichtment would be like a class extending the type. You can add members (maybe even functions, haven't read through the manual THAT thoroughly yet) and make them have their own behaviour.
So, in vJass, when you wanted a unit to have another thing besides HP and MP, for instance, something that keeps track of how sleepy a unit is (irrelevant to alot of things, I know, but I had to come up with something), you would do something like this:
JASS:
struct Unit
unit theUnit
integer sleepyness
method SetSleepyness takes integer i returns nothing
set sleepyness = i
endmethod
endstruct
Code:
enrich unit{
int sleepyness
void SetSleepyness(int i){
sleepyness=i;
}
}
Quite a step forward, if you ask me.
Last edited: