#include
#include
class Book{
private:
char title[80]; int pages; char author[80];
public:
void displayData();
void getData(Book);
void getBook(); };
class Fiction:public Book{
private: int level;
public: void getReadingLevel();
void displayReadingLevel(Fiction);
}; class NonFiction:public Book{private: int numPages;
public: void setNumPages(); void getNumPages(NonFiction);
void displayNumPages(NonFiction);
};
void displayData(Book newBook)
{cout << "The Book you entered is " << newBook.title << "by " << newBook.author << endl;}
void Book::getData(Book newBook)
{cout << "Enter the book title-->: "; cin.getline(newBook.title,80);
cout << "Enter the author's name-->: "; cin.getline(newBook.author, 80);}
void Fiction::getReadingLevel()
{cout << "Enter the reading level-->";cin >> level;}
void Fiction::displayReadingLevel(Fiction f)
{cout << "Reading level is " << f.level << endl;}
Sorry, all I can fit. Public & private members were required
2006-10-19
18:29:42
·
3 answers
·
asked by
ny2neyme
1
in
Computers & Internet
➔ Programming & Design