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.

Functions<br />

Function Overloading<br />

• C++ allows the definition of two or more<br />

functions with the same name<br />

• This is known as Function Overloading<br />

– number or <strong>type</strong>s of parameters must differ<br />

– void writenum(int i) // function 1<br />

{ printf(“%10d”, i);<br />

}<br />

void writenum(float x) // function 2<br />

{ printf(%10.4f”, x);<br />

}<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!