Constructor declaration:
Funcion(std::string cveFunc=" ", int numP = 0, Hora hour(0,0), int room=0);
Constructor:
Funcion::Funcion(std::string cveFunc, int numP, Hora hour(), int room) :
cveFuncion{cveFunc}, numPeli{numP}, hora hour = {}, sala{room}{}
The problem is with the attribute hour i don't know how to declare it correctly.
This is the class hora constructor:
inside class:
Hora(int hhh=0, int mmm=0);
outside class:
Hora::Hora(int hhh, int mmm) : hh{hhh}, mm{mmm} {}
Use of
Funcion::Funcion(std::string cveFunc, int numP, Hora hour(), int room)
is wrong because in that context hour
is declared as a function that takes no arguments and returns an Hour
. You need to remove the ()
. Use:
Funcion::Funcion(std::string cveFunc, int numP, Hora hour, int room)
Assuming hora
is the member variable of the class, the member initialization also needs to be updated to:
cveFuncion{cveFunc}, numPeli{numP}, hora {hour}, sala{room}
Put together, you have:
Funcion::Funcion(std::string cveFunc, int numP, Hora hour, int room) :
cveFuncion{cveFunc}, numPeli{numP}, hora {hour}, sala{room}{}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.