У меня есть домашнее задание, где заголовочный файл предоставляется нам и неизменен. У меня возникли проблемы с выяснением того, как правильно использовать функцию "display" , поэтому вот соответствующий код.
Файл заголовка:
#ifndef SET_
#define SET_
typedef int EType;
using namespace std;
#include <iostream>
class Set
{
  private:
    struct Node
    {
      EType Item;     // User data item
      Node * Succ;    // Link to the node successor
    };
    unsigned Num;     // Number of user data items in the set
    Node * Head;      // Link to the head of the chain
  public:
    // Various functions performed on the set
    // Display the contents of the set
    //
    void display( ostream& ) const;
};
#endif
Вот моя реализация функции "display" :
void Set::display( ostream& Out ) const
{
  Node * temp = Head;
  cout << "{ ";
  while( temp != NULL )
  {
  cout << temp << ", ";
  temp = temp->Succ;
  return Out;
  }
}
И вот мой драйвер:
#include <iostream>
#include <iomanip>
#include "/user/cse232/Projects/project08.set.h"
using namespace std;
int main()
{
  Set X;
  X.insert(10);
  X.insert(20);
  X.insert(30);
  X.insert(40);
  X.display();
}
Ошибка, которую я получаю, говорит, что в моем драйвере я не использую правильные параметры. Я понимаю это, потому что файл .h использует ostream & как параметр. Мой вопрос: что я использую в своем файле драйвера при вызове "display" в качестве хорошего параметра?
