Subclass Problem
I got class BullsAndCowsConsoleView,
subclass this : IBullsAndCowsView
This is what I put in header file of Class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#pragma once
#include "IBullsAndCowsView.h"
#include "BullsAndCows.h"
class BullsAndCowsConsoleView : public IBullsAndCowsView
{
private:
BullsAndCows& fGameModel;
bool fActive;
public:
BullsAndCowsConsoleView( BullsAndCows& aGameModel );
virtual int guess();
virtual void showGuess();
virtual void startNewGame();
virtual void endGame();
virtual void run();
};
|
This is another 2 Header Files :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#pragma once
#include <string>
class BullsAndCows
{
private:
int fSecretNumbers[9];
int fBulls;
int fCows;
public:
BullsAndCows();
void start();
bool guess( std::string aNumberString );
int getBulls() const;
int getCows() const;
};
2nd
#pragma once
class IBullsAndCowsView
{
public:
virtual ~IBullsAndCowsView() {}
virtual int guess() = 0;
virtual void showGuess() = 0;
virtual void startNewGame() = 0;
virtual void endGame() = 0;
virtual void run() = 0;
};
|
Now I want to cout in BullsAndCowsConsoleView under showguess()
how do i do that ???
i cant use pointer.
Last edited on
The same as you would use cout in any other function or method. I'm not sure I understand the problem.
Is the problem that you don't know how to define a method? Any textbook or tutorial should show you that.
yeah i want to define it !!!
like void :: showguess() something like that
and in this i have to cout getBulls () and getcows()
Topic archived. No new replies allowed.