Skip to content

Instantly share code, notes, and snippets.

@sumoward
Created July 7, 2014 19:40
Show Gist options
  • Save sumoward/3d53e4661d9b1b3d36c7 to your computer and use it in GitHub Desktop.
Save sumoward/3d53e4661d9b1b3d36c7 to your computer and use it in GitHub Desktop.
class FileEntity
{
// members common to File & Folder
// create, copy, delete, move, getInfo, open, etc
};
class Folder : public FileEntity
{
// a folder can have multiple FileEntity (folders or files)
vector<FileEntity> m_VecFileEntity;
// members of Folder
};
class File : public FileEntity
{
// members of File
};
class Drive
{
// members of Drive
// getFreeSpace, getTotalSpace, createPartition, etc
};
class FileSystem
{
vector<FileEntity> m_VecFileEntity;
vector<Drive> m_vecDrives;
@sumoward
Copy link
Author

sumoward commented Jul 7, 2014

interface BaseFileSystem
{
/*Basic file/folder attributes are:
1. File/Folder Size
2. File/Folder Date created
3. File/Folder Date Modified
4. File/Folder permissions - Read, write and execute
5. File/Folder Owner - Owner of the file who defines permissions for other users
6. File/Folder Visibility - Hidden or Visible
7. File/Folder Name

  Hence each one of the above attributes would have public <return type> get() and public void set<AttributeName>(<variable datatype>) */

}

public class File implements BaseFileSystem
{
/The File class should implement all of the methods from interface BaseFilesystem.
In addition, it must also implement following specific methods that can only be associated with physical files
/

    public String getFileExtension(){….}

    public void setFileExtension(String value) {….}

    public String[] getAssociatedPrograms(){ …..}

    public void executable(){ …. };

}

public class Folder implements BaseFileSystem
{

  /*The `Folder` class should implement all of the methods from interface `BaseFileSystem`. In addition, it must also implement following specific methods that can only be associated with the physical 'folders'*/

    public BaseFileSystem[] getSubFoldersAndFiles(){ …. }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment