Create a class named MusicalComposition that contains fields for title, composer, and year written. Include a constructor that requires all three values and an appropriate display function. The child class NationalAnthem contains an additional field that holds the name of the anthem’s nation. The child class constructor requires a value for this additional field. The child class also contains a display function. Write a main()function that instantiates objects of each class and demonstrates that the functions work correctly. Save the file as Compositions.cpp.
1
Expert's answer
2017-12-25T03:45:07-0500
#include <iostream> #include <string> using namespace std; class MusicalComposition { protected: string my_title; string my_composer; int my_year;
Comments
Leave a comment