mercredi 21 mars 2018

call to deleted constructor c++

I have a Program in C++ and it works except for one error

Game.cpp:5:6: error: call to deleted constructor of 'Sep::Interface

The code it tells me that has the error is the following:

: io_(io), config_(config), board_width_(20), board_height_ (10),
 ^   ~~

The code with the error is as follows:

#include "Game.h"
using Sep::Game;

Game::Game(Sep::Interface &io, std::string config)
   : io_{io}, config_{config}, board_width_{20}, board_height_ {10},
   money_{100}, map_
   (static_cast<size_t>(board_width_),
   std::vector<Field::FieldType>(board_height_, Field::FieldType::GRASS))

   {

     io_.out(Interface::SETTING,
       "BOARDSIZE " + std::to_string(board_width_) + " "
       + std::to_string(board_height_));
       io_.out(map_);

   }

   void Game::run()
    {
     io_.out(map_);
   }

   bool Game::setField(Sep::Field &field, int x, int y)
   {
if(((x>=0)&&(x<= board_width_ )) && ((y >= 0) && (y <= board_height_)))
  {

    map_[x][y] = field.getType();
    io_.out(map_);
    return true;
  }
  else
  {
    return false;
  }
   }

I would appreciate it enormously if someone would help me solve the error.

Aucun commentaire:

Enregistrer un commentaire