Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Start with the following class declaration : //base class class Cd { //represents a CD disk private: char performers[50]; char label[20]; int selections; //number

1. Start with the following class declaration : //base class class Cd { //represents a CD disk private: char performers[50]; char label[20]; int selections; //number of selections double playtime; // playing time in minutes public: Cd(char * s1, char * s2, int n, double x); Cd(const Cd & d); Cd(); ~Cd(); void Report() const; // reports all CD data Cd & operator=(const Cd & d); };

Derive a classic class that adds an array of char members that will hold a string identifying the primary work on the CD.If the base class requires that any functions be virtual, modify the base - class declaration to make it so.If a declared method is not needed, remove it from the definition. Test your product with the following program :

#include using namespace std; #include "classic.h" //which will contain #include cd.h

void Bravo(const Cd & disk); int main() { Cd c1("Beatles", "Capitol", 14, 35.5); Classic c2 = Classic("Piano sonata in B flat, Fantasia in C", "Alfred Brendel", "Philips", 2, 57.17); Cd *pcd = &c1;

cout << "Using object directly:\"; c1.Report(); //use Cd method c2.Report(); //use Classic method

cout << "Using type cd * pointer to object: "; pcd->Report(); //use Cd method for cd object pcd = &c2; pcd->Report(); //use Classic method for classic object

cout << "calling a function with a Cd reference argument: "; Bravo(c1); Bravo(c2);

cout << "Testing assignment: "; Classic copy; copy = c2; copy.Report()

return 0; }

Please help me the whole things.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

2. How will you handle the situation?

Answered: 1 week ago