I also went back and forth on how to do proper
inheritance. At first I made a
hodgepodge of private and protected variables, then I made them all private
with protected functions to set them, but then I thought that was just
completely silly and made those variables protected and removed the "set"
functions that weren't necessary. So now
I'm basically back to how it was, with protected variables when the subclasses
need to modify them, and private variables when they don't matter. But if a variable can be private, then I
figure I must be messing something up, because it's unnecessary, I would think. So as I code, I'll change private vars to
protected vars when I use them, and if I never use them at some point, I'll
have to deem them redundant and delete them.
I also did a quick test on the write create/write function
for the player file, so now it saves the player's name. The much tougher thing to do will be to save
the map, which is unique to each player, and I'll need to save 365 rooms, plus
every object in each room, plus whatever else there may be that deals with
that. I would like to be able to simply
write an entire class instance to a file and load it back, so I'm going to do a
little more research before manually writing up every variable.
No comments:
Post a Comment