Question: Help with building a simple vecotr. I am getting an error when I try to store the values. Thanks const int SIZE = 10; //
Help with building a simple vecotr. I am getting an error when I try to store the values. Thanks
const int SIZE = 10; // Number of elements
int count; // Loop counter
// Create a SimpleVector of ints.
MyStaticArray intTable(SIZE);
// Create a SimpleVector of doubles.
MyStaticArraydoubleTable(SIZE);
// Store values in the two SimpleVectors.
for (count = 0; count < SIZE; count++)
{ intTable[count] = (count * 2); //Error: Use of overloaded operator '[]' is ambiguous (with operand types 'MyStaticArray
doubleTable[count] = (count * 2.14); //Error: Use of overloaded operator '[]' is ambiguous (with operand types 'MyStaticArray
}
How do I fix those two error.
intTable[count] = (count * 2; //Error: Use of overloaded operator '[]' is ambiguous (with operand types 'MyStaticArray
doubleTable[count] = (count * 2.14; //Error: Use of overloaded operator '[]' is ambiguous (with operand types 'MyStaticArray
This vecotr object: intTable[count] calls the setter operaotor.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
