我不确定为什么我的显示功能不起作用。我cout
的陈述是这样说的
no match for operator << in std :: cout<<n->movieinventory::movienode::m
有任何想法吗?
class MovieInventory
{
private:
struct MovieNode // the Nodes of the linked list
{
Movie m; // data is a movie
MovieNode *next; // points to next node in list
};
MovieNode *movieList; // the head pointer
bool removeOne(Movie); // local func, used by sort and removeMovie
public:
MovieInventory();
bool addMovie(Movie);
int removeMovie(Movie);
void showInventory();
Movie findMinimum(); // should be private, but public for testing
void sortInventory();
int getTotalQuantity();
float getTotalPrice();
};
显示代码:
void MovieInventory::showInventory()
{
MovieNode *n;
for (n = movieList; n != NULL; n = n->next)
cout << n->m;
}