I am working a program that imports functions from a file, and stores them as Polynomial objects in a linked list. I have been given a linked list class already built. But i have to make a Database class that performs other operations. I am stuck on one that requires operator overloading.
i need to overload the [] operator for my Database class to call the nth polynomial in the linked list. so that i can perform Polynomial functions on the nth Polynomial in the linked list.
I need to be able to do this:
d[2].print()
with print being a function of the Polynomial class!
the below function is what i have to make
Polynomial& Database::operator[] (int)
{
// not sure what goes here
}
I dont want a whole solution, just an idea of where to start. If any more information is needed to make this clearer let me know.