How can I solve this error:

I get this error when compiling:
cAssignmentOprOverload.cpp:61:36: error: no match for 'operator[]' (operand types are 'const cAssignmentOprOverload' and 'int')
list[i] = otherList[i]; //Line 10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 
#include "cAssignmentOperatorOverload.h"
#include<iostream>
#include<cstdlib>
#include<cassert>
#include "arrayListType.h"

using namespace std;

void cAssignmentOprOverload::print() const
{
    if(length == 0)
        cout << "List is empty." << endl;
    else
    {
        for(int i = 0; i < length; i++)
            cout << list[i] << " ";
        cout << endl;
    }
}
void cAssignmentOprOverload::insertEnd(int item)
{
    if(length == maxSize)
        cout <<"List is full."<< endl;
    else
        list[length++] = item;
}

void cAssignmentOprOverload::destroyList()
{
    delete [] list;
    list == NULL;
    length = 0;
}

cAssignmentOprOverload::cAssignmentOprOverload(int size)
{
    length = 0;
    if(size <= 0)
        maxSize = 10;
    else
        maxSize = size;
    list = new int[maxSize];
    assert(list != NULL);
}
const cAssignmentOprOverload& cAssignmentOprOverload::operator=
                                    (const cAssignmentOprOverload& otherList)
{
    if(this != &otherList)    //avoid self-assignment;          //Line 1
    {
        if(list != NULL)
            destroyList();
        maxSize = otherList.maxSize;                           //Line 4
        length = otherList.length;

        if(maxSize != 0)
        {
            list = new int[maxSize];                          //Line 7
            assert(list != NULL);

            for(int i = 0; i < length; i++)
                list[i] = otherList[i];                      //Line 10
        }
        else
                list = NULL;
      }
      return *this;
}
Okay I have found and resolved my problem.
Thank you all!!!
Topic archived. No new replies allowed.