#include "Automobile.h" Automobile::Automobile(string t, string m, int a, Pilota * d ) { setAutomobile(t,m,a,d); } void Automobile::setAutomobile(string t, string m, int a, Pilota * d ) { targa = t; modello = m; anno = ( (a<1950 || a>2004) ? 2004 : a); driver = d; } void Automobile::setDriver( Pilota * d) { driver = d; } string Automobile::getTarga() const { return targa; } string Automobile::getModello() const { return modello; } int Automobile::getAnno() const { return anno; } Pilota Automobile::getPilota() const { return *driver; } bool Automobile::esistePilota() const { return ( driver != NULL ); } ostream & operator<<( ostream & output, const Automobile & A ) { output << "\n--------------------------------------------\n"; output << "\t Modello= " << A.getModello() << endl << "\t Anno= " << A.getAnno() << endl << "\t Targa= " << A.getTarga() << endl; if ( A.esistePilota() ) output << "\t " << A.getPilota(); else output << "\t NESSUN PILOTA"; output << "\n--------------------------------------------\n\n"; return output; }