Hi, this program is supposed to get data from an input file, have the user add new data, then output the new data in an output file. There are also supposed to be inheritance classes for the different titles. The 2 derived classes should be a fiction one and a non-fiction one. I m quite a begginer at classes so i'm not sure how to carry on! Any help would be great, thanks!

------------------------header file------------------------------------------
#ifndef __BOOK_H__
#define __BOOK_H__

class Book

char date[11];
int booknum;
char catnum[11];
char title[31];
char author[31];
char type;


//instance methods
void readdate(); //function to get data from input file
//void adddata(); //function to add new data
void outputdate(); //function to output data into output file






using namespace std;

int main()

return 0;

----------implementation file-------------------------------------------------




void Book::readdate()
ifstream inFile;





void Book::outputdate()
ofstream outFile;





it looks OK so far - Although I would suggest seperating your file input function out away from your book class, unless you want every single book object to hold exactly the same information (When you close a file and re-open it, the file reads from the start of the file again)

If you're satisfied with the book class at the moment, then your next step is probably to write your Fiction and Nonfiction classes

This article has been dead for over six months. Start a new discussion instead.