D
divya_rathore_
Dear All,
Assuming that I have an object of a templated class of Linked List:
LinkedList<int> IntList
which adds entries using a member function like this:
void AppendEntry(T& entry)
and retrieves any entry using:
T* FindEntry(int pos);
I want to achieve the following:
static LinkedList<int> GenerateList()
{
LinkedList<int> IntList;
// Add 10 integers to the linked list.
for (int i = 0; i < 10; i++)
IntList.AppendEntry(i);
return IntList;
}
int main()
{
LinkedList<int> list;
list = GenerateList();
printf("%d\n", *(list.FindEntry(7-1)));
return 0;
}
Now, compilation is fine on vc++6 but on executing obviously, in
main(), after the line:
list = ParseFiberFile();
the memory locations returned get free (all become FE EE). Kindly
resolve this for me. I understand that I am missing on some C++ basics
here.
thanks in advance,
Divya Rathore
Assuming that I have an object of a templated class of Linked List:
LinkedList<int> IntList
which adds entries using a member function like this:
void AppendEntry(T& entry)
and retrieves any entry using:
T* FindEntry(int pos);
I want to achieve the following:
static LinkedList<int> GenerateList()
{
LinkedList<int> IntList;
// Add 10 integers to the linked list.
for (int i = 0; i < 10; i++)
IntList.AppendEntry(i);
return IntList;
}
int main()
{
LinkedList<int> list;
list = GenerateList();
printf("%d\n", *(list.FindEntry(7-1)));
return 0;
}
Now, compilation is fine on vc++6 but on executing obviously, in
main(), after the line:
list = ParseFiberFile();
the memory locations returned get free (all become FE EE). Kindly
resolve this for me. I understand that I am missing on some C++ basics
here.
thanks in advance,
Divya Rathore