Hello!
I have a homework for tomorrow, and I simply can't solve it.
I have a list (with template) class, I wrote and it has an operator:
For using the elements with indexes.
And I've got an another class, which puts the elements of an object(template ) in order.
And when I make a pointer of this classin main, and I try to just write on the console one of the elements...it doesn't work:
Could someone help me in this?
I have a homework for tomorrow, and I simply can't solve it.
I have a list (with template) class, I wrote and it has an operator:
Code:
T& operator[](int i)
{
ToFirst();
for(int j=0;j<i;j++)
{
StepForward();
}
return Act->value;
}
And I've got an another class, which puts the elements of an object(template ) in order.
And when I make a pointer of this classin main, and I try to just write on the console one of the elements...it doesn't work:
Code:
int main()
{
Lista<int> *tmp;
int b[]={56,2,87,11,8,34,56,1,9,31,5};
for(int i=0;i<11;i++)
{
tmp->InsertLast(b[i]);
} <- filling my list
cout<<tmp[3];
}
Comment