Forgive me as my C++ is very rusty. But I am in a bind. I am trying to make a custom list that have methods to return the front most, and back most items.
ElementType& front() throw(string*)
{
if (empty())
throw new string("Empty Vector");
else
return(first)
}
My main problem is that I don’t have the actual first item, I have a pointer to it and I have no idea how to go about taking a reference of what the pointer is pointing it, using only the pointer. I’ve tried things similar to:
ElementType& *first
or
&*first
but I can’t get them to play nicely. Any advice would be greatly appreciated.
If
firstis a pointer to your element,*firstwill give you a reference to it.