Hi there, I am new to C++ and I got this error.
IntelliSense: no operator "+" matches these operands
The problematic line of code is:
cout << i << "\t" << temp->VehicleNo + "\n";
Link to picture showing context of error
Hi there, I am new to C++ and I got this error.
IntelliSense: no operator "+" matches these operands
The problematic line of code is:
cout << i << "\t" << temp->VehicleNo + "\n";
Link to picture showing context of error
So, temp->VehicleNo
is object of class Vehicle
and this class has a member VehicleNo
of type std::string
. To display that string you need this code:
cout << i << "\t" << temp->VehicleNo.VehicleNo << "\n";
I would propose that you rename Node::VehicleNo
to Node::Vehicle
, so that in the code above the code would be temp->Vehicle.VehicleNo
, which makes more sense.