12.05.2015 Views

type - David Vernon

type - David Vernon

type - David Vernon

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Object-Oriented Programming<br />

Virtual Functions and Late Binding<br />

• Suppose we have declared class c<strong>type</strong> as<br />

follows:<br />

class c<strong>type</strong> {<br />

public:<br />

virtual void f()<br />

{ ...<br />

}<br />

...<br />

};<br />

– the keyword virtual is important if<br />

» c<strong>type</strong> has derived classes, e.g. c<strong>type</strong>1 and c<strong>type</strong>2, (i.e. it is<br />

a base class for derived classes c<strong>type</strong>1 and c<strong>type</strong>2)<br />

» and we are using pointers to class objects<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!