Hey everyone. I'm trying to add the sum of 2 double values from a map who have a string key. I think the operator[] needs to be overloaded to accomplish this.
int main()
{
Items testing;
testing.add("Item1", 19.95);
testing.add("Item2", 24.95);
testing.add("Item3", 8.99);
// need to overload [] operator for this to work
double total = prices["Item1"] + prices["Item2"];
cout << total;
cout << prices["Item1"];
system("pause");
return 0;
}
Here is where I need help - I stink at overloading.