I am working on a game, creating a basic, Model-View-Controller, setup. I am trying to create three variables, a Model, a View which takes a pointer to model and a controller which takes a pointer to Model and View. However I am getting an error saying that the constructor for Views(Model*) has been declared implicitly and cannot be referenced as it has been deleted. I have attempted many things but have yet to find a solution to this. Any help would be greatly appreciated! Below is all the code in question, I can include anything else that is requested!
From Game.h:
#include "Controller.h"
#include "Model.h"
#include "Views.h"
class Game
{
public:
Game();
~Game();
int launch();
Controller contrl;
Model model;
Views view;
};
From Game.cpp
Game::Game()
{
model = Model();
view = Views(&model); // <- gives error
contrl = Controller(&model, &view);
}
Views.h:
#include <SFML\Graphics.hpp>
#include "Model.h"
class Views
{
public:
Views();
Views(Model*);
~Views();
int render();
sf::RenderWindow window;
Model* model;
};
Views.cpp:
Views::Views()
{
}
Views::Views(Model* m) {
model = m;
}
Views::~Views()
{
}