# The following was supposedly scribed by
# Sisyphus
# on Sunday 19 June 2005 01:36 am:

>The exisiting DESTROY() routine won't cope with having to clean up
> Civilian structures. Is there a way that the DESTROY() routine can be
> modified so that it can clean up both Civilian and Soldier structures
> ? 

Yes.

> ... or does the Civilian structure need to be blessed into its own 
> separate package - with its own separate DESTROY() routine ?

Yes.

You *could* add some sort of flag to your struct and an if() to 
DESTROY().  Alternatively, you could write DESTROY() in perl and call 
one of two C methods from there.

But most would argue that the civilian is not the same as a soldier?

Presumably you have a set of methods that works on both of them?

I haven't tried it, but what about inheritance?  If Civilian @ISA 
Soldier, then you just override new() and DESTROY() right?  You would 
need another constructor anyway to get a different struct.

--Eric
-- 
"I've often gotten the feeling that the only people who have learned
from computer assisted instruction are the authors."
--Ben Schneiderman
---------------------------------------------
    http://scratchcomputing.com
---------------------------------------------

Reply via email to