I take
./Mission.h:56:11: note: candidate function not viable: no known conversion from 'Passenger *' to 'const Passenger' for 1st argument; dereference the argument with * Mission& operator+=(const Passenger &passenger); ^ ./Mission.h:58:11: note: candidate function not viable: no known conversion from 'Passenger *' to 'const Astronaut' for 1st argument Mission& operator+=(const Astronaut &astronaut); And I define in header file the overloaded func
Mission& operator+=(const Astronaut &astronaut); In func define
Mission& Mission::operator+=(const Astronaut &astronaut){ implementing
moonMission += astronautList[0]; moonMission += astronautList[1]; moonMission += astronautList[2]; I define array like this
Astronaut* astronautList[5]; Why it is not viable? I want to send my pointer array to a overloaded function and array define can't be changed. I only allowed to change overloaded function.
https://stackoverflow.com/questions/67259865/operator-overloading-type-not-viable April 26, 2021 at 09:42AM
没有评论:
发表评论