[DGD]Includes

Tim Vernum tpv at acay.com.au
Thu May 24 06:51:46 CEST 2001


>I have some functions in cmd.h that are inherited to player.c 

[1]
Precompiler directives (those '#' statements) are generally fairly primitive.

#include does pretty much what it says.
"Find this file, open it, and cut-and-paste the code into this spot"

If living.c "#include"s cmd.h, then everything in cmd.h is part of the "living"
object. You cannot undo that after the fact.

[2]
If "living" includes code that you don't want in "player", but "player" inherits
from "living", then your object design is wrong.

inherits (generally) means "is-a", so "player" is-a "living".
And if living can do all the things in cmd.h, and player is a living, then player
should be able to do the things in cmd.h

What you probably want is:

"living" DOES NOT include "cmd.h"
"player" inherits living
"monster" inherits living and includes "cmd.h"


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



More information about the DGD mailing list