13.07.2015 Views

29 The Power of Inheritance and Polymorphism

29 The Power of Inheritance and Polymorphism

29 The Power of Inheritance and Polymorphism

SHOW MORE
SHOW LESS

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!