no viable overloaded '=' error C++ -
i'm trying store proper ticket variable (either t1 or t2) t3 can return main. when use "=" set either t1 t3, says "no viable overloaded '='". following code:
using namespace std; class ticket { public: ticket(); double input(); double output(); friend ticket operator *(const ticket &t1, const ticket &t2); friend ticket operator /(const ticket &t1, const ticket &t2); private: void cost(); string name; double miles, price; int transfers; };
the variable c1
, literal '\0'
of type char
, not instances of character
structure.
the types char
, character
totally unrelated , can't convert between two.
a simple solution create conversion constructors character
structure, accepts single char
argument , initialize structure character.
or create character
structure , explicitly set correct member character want.
Comments
Post a Comment