29 The Power of Inheritance and Polymorphism
29 The Power of Inheritance and Polymorphism
29 The Power of Inheritance and Polymorphism
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Inheritance</strong> <strong>and</strong> <strong>Polymorphism</strong> 1056}fD->Display()->Clear(fPos.X(), fPos.Y());void DungeonItem::Draw(){fD->Display()->Set( fPos.X(), fPos.Y(), fSym);}All DungeonItem objects must read their coordinates, <strong>and</strong> the data given asinput must be checked. <strong>The</strong>se operations are defined in DungeonItem::Read().void DungeonItem::Read(ifstream& in){int x, y;in >> x >> y;if(!in.good()) {cout