game.h में ostream कोस्टोर सूचक iStream और एक वर्ग सी ++
#ifndef GAME_H
#define GAME_H
#include <string>
#include <iostream>
#include "piece.h"
using namespace std;
class Game
{
private:
string white;
string black;
string title;
istream* in;
ostream* out;
public:
Game();
Game(istream&, ostream&);
void display(Colour, short);
};
#endif
game.cpp
#include <iostream>
#include <string>
#include <sstream>
#include "game.h"
#include "board.h"
#include "piece.h"
using namespace std;
Game::Game()
{
//nothing
}
Game::Game(istream& is, ostream& os)
{
in = is;
out = os;
}
void Game::display(Colour colour, short moves)
{
//out << "a";
}
मैं IStream और मेरी कक्षा के अन्य भागों में ostream उपयोग करने के लिए कोशिश कर रहा हूँ, लेकिन मैं नहीं कर सकता क्योंकि g ++ मुझे संदर्भ देने की अनुमति नहीं देगा। कोई विचार?
मैंने http://stackoverflow.com/questions/366955/obtain-a-stdostream-either-from-stdcout-or-stdofstreamfile/366969#366969 से सहायता का भी उपयोग किया – Steven