Does anyone know what is wrong here
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#include<iostream>
using namespace std;
struct datum{
int dan;
int mjesec;
int godina;
Datum() {}
datum(int d, int m, int g){
dan=d;
mjesec=m;
godina=g;
}
void ispisiDatum(){cout<<dan<<" "<<mjesec<<" "<< godina<<endl;}
};
class vozilo{
string tablica;
double cijena;
datum zadnja_registracija;
public:
vozilo(string t, double c, datum z){
tablica=t;
cijena=c;
zadnja_registracija=z;
}
void registruj(datum novi){
zadnja_registracija=novi;}
string dajTablicu(){
return(tablica);
}
double dajCijenu(){
return(cijena);
}
datum dajDatum(){
return (datum);}
};
int main(){
vozilo audi("neko-33", 150000.,datum(19,6,2018));
cout<<audi.dajTablicu();}
|
Compiler says that there is an error in struct datum, but I can't find it.
Last edited on
Caps.
Names are case sensitive.
You struct is datum.
You have a constructor function you wrote as "Datum()"
Topic archived. No new replies allowed.