12.05.2015 Views

type - David Vernon

type - David Vernon

type - David Vernon

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Object-Oriented Programming<br />

Virtual Functions and Late Binding<br />

• Pure virtual functions and abstract classes<br />

– We can declare the function print in the base class<br />

as a pure virtual function by writing<br />

virtual void print() const = 0;<br />

– This has some important consequences<br />

» the base class now becomes an abstract class<br />

» an abstract class cannot be used to create objects (or this<br />

<strong>type</strong>)<br />

» they can only be used for the declaration of derived classes<br />

Copyright © 2007 <strong>David</strong> <strong>Vernon</strong> (www.vernon.eu)

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

Saved successfully!

Ooh no, something went wrong!