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 />

Derived Classes and Inheritance<br />

• Constructors and destructors of derived and<br />

base classes<br />

– We can pass arguments from the constructor in a<br />

derived class to the constructor of its base class<br />

» normally do this to initialize the data members of the base<br />

class<br />

» write a constructor initializer<br />

class square: public geom_obj {<br />

public:<br />

square(float x_C, float y_C, float x,float y)<br />

: geom_obj(x_C, y_C) // con. init.<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!