#include using namespace std ; //Using references to let a function be a l value //Use case //-------------------------------------------------------------------- class myVector { public: int x1 ; int array1[3] ; myVector(): array1{ 1, 2, 3 } { } int& operator[] (int index) { return array1[index] ; } }; //-------------------------------------------------------------------- int main() { myVector myVectorObj ; cout << myVectorObj[0] << endl ; myVectorObj[0] = 100 ; cout << myVectorObj[0] << endl ; return(0) ; } //--------------------------------------------------------------------