Question 12: In C++, which of the following is the best declaration for an overloaded operator[] to allow read-only access (and

template<typename T>

class MyArray

{

    //declaration goes here

};

 

    A. T& operator[](size_t i);

    B. const T& operator[](size_t i);

    C. const T& operator[](size_t i) const;

    D. T& operator[](size_t i)const;

    E. T& operator[](const size_t i);

C

你可能感兴趣的:(C++,c,Access)