06.01.2015 Views

IMPARARE IL C++ in 6 ore? - INFN

IMPARARE IL C++ in 6 ore? - INFN

IMPARARE IL C++ in 6 ore? - INFN

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Il puntat<strong>ore</strong> this<br />

Ogni membro di una classe ha un parametro<br />

nascosto : il puntat<strong>ore</strong> “this”In ogni chiamata di<br />

un metodo <strong>in</strong>terno (GetAge(),SetAge()) anche il<br />

puntat<strong>ore</strong> this per quell’oggetto e’<br />

<strong>in</strong>cluso.Tuttavia spesso e’ utile utilizzare<br />

esplicitamente this per il potere che hanno I<br />

puntatori come nell’esempio<br />

void SetLenght(<strong>in</strong>t length) {this->itsLength=length;}<br />

THIS stora <strong>in</strong>fatti l’<strong>in</strong>dirizzo di memoria dell’oggetto <strong>in</strong><br />

questione(theCat,Frisky,BMW520 etc.etc)

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

Saved successfully!

Ooh no, something went wrong!