class A
{
public:
void *operator[](constint &index)
{
return item[i];
}
public:
void **item;
};
class B
{
public:
class A *item_a;
}
I have a litle problem when I try to use the operator overloaded.
If I do something like this:
1 2 3
class B cb;
...
void *item = cb.item_a[i];
The compiler tell me that cannot convert class A to void *
To make this work, I need to "call" the operator directly:
1 2 3
class B cb;
...
void *item = cb.item_a->operator[](i);
So, now, this works, but I think this is not an "elegant" solution and make teh use of operator [] pointless (shure is better to call a function that returns the element).