How to use -> with index operator []?

Hi!
I would like to know how can i use "->" with index oprator "[]"

1
2
3
4
5
void Historic::showRanking(QTableWidget *table, QList<Number> *bols)
{
    //...code here
    bols[ i ]->val //Herror here. I have to use "at( i ).val" to work. Why?
}


Thanks!
-> is for use with pointers to objects while . is for use with objects. If you can use 'at(i).val' then I'm guessing you are addressing an object not a pointer to an object.

Edit: looking more closely, you are using a Number object inside of QList bols. If it were 'QList<Number*> *bols' then you would use 'at(i)->val' as the objects inside the list would be pointers.
Last edited on
I understand. Thank you very much!
Topic archived. No new replies allowed.