Alright, first off yes this is homework, but i'm giving it my try...but i just need some guidance on a few things. I honestly NEED to learn this stuff, and i know that.
edit: clarify...i already wrote this code (except the test program, that is given to us)....i just need help correcting and understanding.
Code:
class Folder
{
public:
Folder (bool& type, char* name, char* exten, double& size, char* date);
add_entry(bool&, char* name, char* exten, double& size, char* date);
delete_entry(char* name, char* exten);
list_entry(char* name, char* exten);
list_folders();
Folder operator + (Folder& a, Folder& b);
private:
bool type;
char name[8];
char exten[3];
double size;
char date[10]; //must be xx/xx/xxxx format
}
list_entry(char* name, char* exten)
{
//what code?
}
Ok, the test program will be something like this:
Code:
int main () {
Folder f1;
f1.add_entry (true, "first", "dat", 1500, date);
f1.add_entry (true, "second", "dat", 1500, date);
f1.add_entry (true, "third", "txt", 1500, date);
f1.list_folder();
f1.delete_entry("second", "txt");
f1.list_folder();
f1.delete_entry("second", "dat");
f1.list_folder();
f1.add_entry (true, "SECOND", "dat", 1500, date);
f1.list_folder();
f1.delete_entry("*", "dat");
f1.list_folder();
// etc.
}
I am retarded when it comes to classes, my teachers taught it in a way i really don't understand. I understand structs really well, but i am LOST when it comes to classes, and i've been trying really hard to learn it.
If anyone can kinda walk me through some of it explaining WHY things are how they are (or why they are wrong)...i'd VERY much appreciate the lesson. Thanks!