Create a class called Musicians to contain three functions string ( ), wind ( )
ID: 3888281 • Letter: C
Question
Create a class called Musicians to contain three functions string ( ), wind ( ) and perc ( ).
Each of these functions should initialize a string array to contain the following instruments:
- veena, guitar, sitar, sarod and mandolin under string ( )
- flute, clarinet saxophone, nadhaswaram and piccolo under wind ( )
- tabla, mridangam, bangos, drums and tambour under perc ( )
It should also display the contents of the arrays that are initialized.
Create a derived class called TypeIns to contain a function called get ( ) and show ( ). The get ( ) function must display a means as follows:
Type of instruments to be displayed
a. String instruments
b. ind instruments
c. Percussion instruments
The show ( ) function should display the relevant detail according to our choice. The base class variables must be accessible only to its derived classes.
Explanation / Answer
#include #include using namespace std; class Musicians { protected: char instrument[15][15]; public: void string() { strcpy(instrument[0], "Veena"); strcpy(instrument[1], "Guitar"); strcpy(instrument[2], "Sitar"); strcpy(instrument[3], "Sarod"); strcpy(instrument[4], "Mandolin"); //coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.