H class item public itemid 0 virtual item cout

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t;<endl;} }; 清清清清清清清清 CIMS 清清 clude <iostream> ng namespace std; m note { middleC, Csharp, Eflat }; // Etc. ss Instrument { Instrument::play lic: oid play(note) const { cout << "Instrument::play" << endl; 清清清清清清清清 清清清清清清清清清清清清 Wind objects are Instruments 突突突 Wind 突突突突突突 because they have the same interface: Instrument ss Wind : public Instrument { lic: / Redefine interface function: oid play(note) const { cout << "Wind::play" << endl; } d tune(Instrument 突 & i) { / ... .play(middleC); 清 突突突突 example1instrument main() { ind flute; u n e ( f l u t e ) ; / / 清清清清清清清清清清清清清清清清清清 3 清清清清清清清清 CIMS 清清 突突 ? 清清 清清清清清清 清清清清清清清 C++ 清清清 清清清 清清清清清 清清清清清清清清 4 清清清清清清清清 CIMS 清清 nclude <iostream> ing namespace std; um note { middleC, Csharp, Eflat }; // Etc. ass Instrument { Instrument::play blic: void play(note) const { cout << "Instrument::play" << endl Wind objects are Instruments 突突突 Wind 突突突突突突 because they have the same interface: Instrument ass Wind : public Instrument { blic: // Redefine interface function: void play(note) const { cout << "Wind::play" << endl; } id tune(Instrument 突 & i) { // ... i.play(middleC); 清 突突突突 example1instrument t main() { Wind flute; t u n e ( f l u t e ) ; / / 清清清清清清清清清清清清清清清清清清 5 清...
View Full Document

Ask a homework question - tutors are online