[DGD]checking inheritance

Richard Braakman dark at xs4all.nl
Fri Aug 4 15:31:46 CEST 2000


On Fri, Aug 04, 2000 at 02:22:00PM +0000, boris wrote:
> Secondly, you must know the exact name of that function. If you
> rename or remove that function, this implementation will become
> a potential bug.
> 
> So I wonder if there is a more elegant way of doing this in DGD-LPC ?

Yes, you could define a function explicitly for this purpose, so that
you know not to change its name in the future:

/* Other objects use this function name to test our program name */
int is_npc() { }

And if you're going to do that anyway, you might as well just call it
instead of bothering with function_object().

/* This object is an NPC */
int is_npc() { return 1; }

This way, inheriting objects can also redefine the function if they
want.  If you don't want to allow that, you can stick with
function_object() and declare the function to be nomask.

Richard Braakman

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list