View Single Post
  #35  
Old 06-24-2007, 11:22 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Inheritance in Graal doesn't work like that, you're not supposed to overwrite functions or variables. You're just supposed to extend the functionality of the supertype without changing it or complete its functionality if the supertype is abstract. If you observe the object type structure on the Wiki you'd notice that functions and variables are never overwritten by subtypes.

An example of this is the TXMudContainer type on Aeon. Its abstract and gives all subtypes (most especially TXMudPlayer) the ability to hold items. This allows for easy moving of item objects between players, npcs, and containers in the world like barrels and crates.

One of the tools I find invaluable for modularity and object types is this function, triggerAll():
PHP Code:
public function triggerAll(eventnameparam0param1param2param3param4param5param6param7param8param9) {
  
this.scriptlogmissingfunctions false// for no RC errors.
  
  
temp.0;
  
temp.list = this.joinedclasses;
  
  list.
remove("util_triggerall"); // Class with this script
  
makevar(eventname "_base")(param0param1param2param3param4param5param6param7param8param9);
  for (
0< list.size(); ++) {
    
makevar(eventname "_" @ list[i])(param0param1param2param3param4param5param6param7param8param9);
  }

I don't find the classname::functionname() syntax too reliable.
__________________
Reply With Quote