我得到一個不尋常的錯誤: error: expected unqualified-id before ‘&’ token 源代碼: // Overloading the c++ array subscript operator [ ]
#include<iostream>
using namespace std;
const int size=10;
class myArray
{
例子: long a;
BoundedCounter e;
所以我想在班上分配私有變量計數器的值的。 a=e;
使用這種嘗試: long int & operator=(long b)
{
b=counter;
return b;
}
和 long int & operator=(long b, BoundedCounter &a)
{
b=a.g