template <typename TYPE>
class OrderedCollection
{
protected:
int container_size, container_capacity;
TYPE* content;
public:
// default constructor
// copy constructor
// and many more
const TYPE& front () const;
const TYPE& back ()const;
};
//
// my question is, Is this ok, for some reason it does not look right.
// I canot test the code to check I have to write it for now and then test it.
const TYPE& OrderedCollection <TYPE>::front()const
{
TYPE temp; // create a temporary onj to acces the content
// [0] is the front of the OrderedCollection(array)
return(temp.content[0]);
// or this way???
//return content[0];
}
// same with this
template <typename TYPE>
const TYPE& OrderedColection <TYPE>::back()const
{
TYPE temp;
for(int i= 0; i <= container_size; ++i)
{
int var = i;
}
return(temp.content[i]);
// or this way??? like above
// return content[i];
}