I've got a function for my memory management simulator, runSimulation() that is taking a MManager object.
However, since I'm supposed to be implementing various algorithms, I made a pure virtual base class, and then just instantiate MManager as the proper subclass. The problem with this is MManager is pure virtual, so I can't instantiate it.
and then I have a class like:
What's the best way to do this so I can write the simulation using MManager objects in the actual simulation. Should I just convert the MManager methods to do-nothing methods instead of pure-virtual?
However, since I'm supposed to be implementing various algorithms, I made a pure virtual base class, and then just instantiate MManager as the proper subclass. The problem with this is MManager is pure virtual, so I can't instantiate it.
Code:
class MManager
{
public:
virtual void compaction() = 0;
virtual int grab_memory(Process*) = 0;
virtual void free_memory(Process*) = 0;
}
and then I have a class like:
Code:
class WorstFit : MManager
{
public:
void compaction();
int grab_memory(Process*);
void free_memory(Process*);
private:
deque<Process*> mem;
}
What's the best way to do this so I can write the simulation using MManager objects in the actual simulation. Should I just convert the MManager methods to do-nothing methods instead of pure-virtual?