03.12.2012 Views

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

3.7. ACCESSING OBJECT MEMBERS 83<br />

{<br />

}<br />

return data[r∗ncols + c];<br />

Adding range checking — in a separate function <strong>for</strong> better reuse — can safe us a lot of debug<br />

time in the future. We also implement the constant access:<br />

private:<br />

void check(int r, int c) const { assert(0

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

Saved successfully!

Ooh no, something went wrong!