parking lot系统的OOD# JobHunting - 待字闺中
q*x
1 楼
还能加点啥油盐酱醋?Slot有large,mid-size,compact之分,搞个继承/多态出来?
class Slot {
public:
int calcFee();
void resetTimer();
private:
int timeStamp;
};
class Manager {
public:
Slot* getFreeSlot();
void reclaimSlot(Slot* s);
private:
list freeSlots;
list occupiedSlot;
};
class Slot {
public:
int calcFee();
void resetTimer();
private:
int timeStamp;
};
class Manager {
public:
Slot* getFreeSlot();
void reclaimSlot(Slot* s);
private:
list
list
};