At the moment, the base class for all the Archives ArchiveBase is derived from FileManager. Instead, the file manager should be a stand alone namespace.
namespace FileSystem {
/*
Abstract base class for all file i / o classes to inherit from.
*/
class FileManager {
public:
/*
@param filename_ name of file to operate on
*/
FileManager(const std::string & filename_) :filename(filename_) {}
/*
@effects read from the file specified by gilename
*/
virtual void Read() = 0;
/*
@effects write to the file specified by filename
*/
virtual void Write() = 0;
protected:
std::string filename;
};
};
becomes
namespace FileSystem {
/*
@effects read from the file specified by filename
*/
void Read(std::string& filename);
/*
@effects write to the file specified by filename
*/
void Write(std::string& filename);
};
};
You then must implement the functions and create FileManager.cpp. Examples of these implementations can be found online.
You will not be specifically writing anything, so the written files specified by filename will be empty.
The ArchiveBase then needs its own Read and Write functions. e.g
/*
@effects read from the file specified by gilename
*/
virtual void Read() = 0;
/*
@effects write to the file specified by filename
*/
virtual void Write() = 0;
After you implement this, all the Archive classes will keep their inherited Read and Write function overload.
At the moment, the base class for all the Archives
ArchiveBase
is derived fromFileManager
. Instead, the file manager should be a stand alone namespace.becomes
You then must implement the functions and create
FileManager.cpp
. Examples of these implementations can be found online.You will not be specifically writing anything, so the written files specified by
filename
will be empty.The
ArchiveBase
then needs its ownRead
andWrite
functions. e.gAfter you implement this, all the
Archive
classes will keep their inheritedRead
andWrite
function overload.