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.

Uso classi:un primo esempio<br />

#<strong>in</strong>clude <br />

class Car<br />

{<br />

public:<br />

//metodi pubblici<br />

void Start();<br />

void accelerate();<br />

void setYear(<strong>in</strong>t Year); //dichiarazione della classe Car<br />

<strong>in</strong>t GetYear();<br />

private:<br />

<strong>in</strong>t theYear;<br />

//variabili private<br />

char Model[255];<br />

};<br />

Car BMW530;<br />

Int immatricolazione;<br />

BMW530.SetYear(i99);<br />

immatricolazione=BMW530.getYear(); //che hanno sara’ la BMW

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

Saved successfully!

Ooh no, something went wrong!