C++ Operator Overload [ ]
<p>let's say i have the following classes:</p>

<pre><code>class temp1 {
private:
    int A;
    double B;
};

class temp2 {
private:
    int A[20];
    double B;
};

void main() {
    temp1 a[100];
    temp2 b;
}
</code></pre>

<p>now the question is why do i need to overload the operator [ ] only for temp2 and not for temp 1 aswell ?
i know that inorder to get to the 10 index in veriable A in class temp 2 i will need to overload indeed the operator [ ] but in the main i have array of classes
(temp1 a[100]) so how the compiler knows what will i mean when i will use [ ] operator without overloading one.</p>