'C++ Class entry
Ive been asked to write a C++ class entry and derive from it three subclasses. . The class Entry should have member variables to store the name of the item and if it is borrowed and by who. The subclasses should have additional data members as specified in the diagram. Include member function declarations into your four class definitions according to the diagram. In addition, include two constructor declarations for each of the subclasses: one constructor with parameters for passing the values of all data members and another constructor with no parameters, but which allows the user to enter the values for all data members interactively. Use virtual functions appropriately. Write definitions of all member functions for all classes. The functions printDetails() should display the values of their class data members.
Im not so sure how to start and so this is the code ive began with:
#include <iostream>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;
class entry
{
bool borrowed;
string borowedby;
string name;
string year;
public:
entry();
void entryBorrowed();
void entryReturned();
void printDetails();
};
class MusicAlbum : public entry
{
string artist;
string recordlabel;
void printDetails();
};
class Book : public entry
{
string author;
string publisher;
string edition;
void printDetails();
};
class Film : public entry
{
string director;
string language;
void printDetails();
};
//Any help is greatly appriciated//
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
