int main(int argc, char *argv[]){ InstrumentFactory * trumpetFactory = FactoryCreator::createTrumpetFactory(); InstrumentFactory * drumFactory = FactoryCreator::createDrumFactory(); InstrumentFactory * guitarFactory = FactoryCreator::createGuitarFactory(); Instrument * trumpet = trumpetFactory->createInstrument(); Instrument * drum = drumFactory->createInstrument(); Instrument * guitar = guitarFactory->createInstrument(); trumpet->play(); drum->play(); guitar->play(); }
void tune (Instrument &i){ i.prepare(); i.play(middleC); }
void tune(Instrument& i) { // ... i.play(middleC); }
void play(Instrument& i) { cout << "Playing a " << i.what() << "... "; i.play(middleC); }
//DO NOT MODIFY this function void tune(Instrument& i) { i.play("middleC"); }