25.09.2017 Views

cpp_tutorial

Create successful ePaper yourself

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

C++<br />

{<br />

public:<br />

double length;<br />

double breadth;<br />

double height;<br />

// Length of a box<br />

// Breadth of a box<br />

// Height of a box<br />

};<br />

// Member functions declaration<br />

double getVolume(void);<br />

void setLength( double len );<br />

void setBreadth( double bre );<br />

void setHeight( double hei );<br />

// Member functions definitions<br />

double Box::getVolume(void)<br />

{<br />

return length * breadth * height;<br />

}<br />

void Box::setLength( double len )<br />

{<br />

length = len;<br />

}<br />

void Box::setBreadth( double bre )<br />

{<br />

breadth = bre;<br />

}<br />

void Box::setHeight( double hei )<br />

{<br />

height = hei;<br />

}<br />

162

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

Saved successfully!

Ooh no, something went wrong!