C++ error: no match for 'operator[]' (operand types are 'const my_array_over' and 'size_t' {aka 'long unsigned int'}) (stackoverflow.com)stack
11 points by harumichi113 in stackoverflow.com · 4y ago · stack comments
#include <iostream> using namespace std; class my_array_over { size_t len = 1; int *a = new int[1]; public: my_array_over() { a[0] = 0; } my_array_over(size_t ln, const int *o) : len(ln), a(new int[ln]) { for (size_t n = 0; n < ln; ++n) a[n] = o[n]; } ~my_array_over() { delete[]…