J
Joachim
Hello,
I have been trying to get the following code to work, but unfortunately
without any succes so far. I have searched in newsgroups and google but
found nothing there that could solve my problem.
Given the following classes :
template <class T>
class AAA{
int tabel[5];
public:
T &getItem(int i){
return tabel;
}
};
template <class T>
class A{
public:
AAA<T> t;
T &operator[](int index) {
return t.getItem(index);
}
};
class B : public A<int> {
public:
void Bfun(){
t[0]=4;
}
};
My gcc compiler comes with the following error:
main.cc27 : error: no match for 'operator[]' in
'((B*)this)->B::<anonymous>.A<int>::t[0]'
Is there anybody who could give me a hint in the right direction? I
tried nonmember functions (for the operator) but the compiler says that
operator[] should be a nonstatic member function.
Thanks in advance,
Joachim
I have been trying to get the following code to work, but unfortunately
without any succes so far. I have searched in newsgroups and google but
found nothing there that could solve my problem.
Given the following classes :
template <class T>
class AAA{
int tabel[5];
public:
T &getItem(int i){
return tabel;
}
};
template <class T>
class A{
public:
AAA<T> t;
T &operator[](int index) {
return t.getItem(index);
}
};
class B : public A<int> {
public:
void Bfun(){
t[0]=4;
}
};
My gcc compiler comes with the following error:
main.cc27 : error: no match for 'operator[]' in
'((B*)this)->B::<anonymous>.A<int>::t[0]'
Is there anybody who could give me a hint in the right direction? I
tried nonmember functions (for the operator) but the compiler says that
operator[] should be a nonstatic member function.
Thanks in advance,
Joachim