hi, I have a class and inheritance problem I have this parent function:
template <typename T>
class Indicateur
{
protected:
T indicateur;
T data;
size_t length;
public:
Indicateur(const T& _data, size_t _length);
const typename T::value_type operator[](size_t index) const;
void update_data(const T& _data);
int size() const;
virtual void calcul();
};
the function in parent class
template <typename T>
const typename T::value_type Indicateur<T>::operator[](size_t index) const
{
if (index < indicateur.size())
{
return indicateur[index];
}
else
{
throw std::out_of_range("Index out of range");
}
}
this class works very well except that I replace the data with a struct which contains vectors so I would like to modify the function with operator=[] to be able to do Myclass.vectorofmystruc[i] but I don’t know how can I do this. And I don't know how to prevent the use of the initial [] function that I inherit