yungman
- 5,741
- 294
Thanks for the reply.pbuk said:As has been mentioned before, this is NOT the way your 'Directory' program should be broken down.
Classes should NOT be used to collect fuctions according to what they do, they should be used to collect functions together with the entity they do it to.
Your directory class should have the following public methods:
Code:Directory::readFile; Directory::writeFile; Directory::add; Directory::find; Directory::sort;
I thought it's more logical to have a class to write and read file with a given vector of structure. Then one class to handle the vector manipulations.
In my mind, ultimately, I want the vectorManage class to receive any vector with a specific member variable used for sorting( second for finer sorting like first name) but NOT specific to last name or first name. Then another class to read write file with a vector and name/destination of the file as parameters. This way, it will be general purpose for other use. for example if I want to do an inventory program with parts given the part number. I can use the same two classes, I can sort the parts and save in file.
With that, I can make the two classes as general purpose. Directory is only one of the program that uses this two classes.
What you suggested is more like a member function within the vectorManage. Isn't better to put those in the Implementation files .cpp?
Thanks
Last edited: