**menu button class:**
#ifndef __FORGE_MENU_BUTTON_HPP__
#define __FORGE_MENU_BUTTON_HPP__
#include "ForgeConstruct.hpp"
#include "ForgeConstructFactory.hpp"
class ForgeMenuButton : public ForgeSDLConstruct {
public:
ForgeMenuButton() : ForgeSDLConstruct() {}
virtual void load(const ForgeConstructParams*);
.
. more code in here but removed conciseness
.
};
**class ForgeMenuButtonCreator : public ForgeBaseCreator{
ForgeConstruct* createForgeConstruct() const {
return new ForgeMenuButton();**
}
};
**base class**
class ForgeBaseCreator{
public:
virtual ForgeConstruct* createForgeCosntruct() const = 0;
virtual ~ForgeBaseCreator(){}
};
Inheriting and defining
class ForgeMenuButtonCreator : public ForgeBaseCreator{
ForgeConstruct* createForgeConstruct() const {
return new ForgeMenuButton();
}
};
calling from Game loop .cpp
ForgeConstructFactory::Instance()->registerType(“MenuButton”, new ForgeMenuButtonCreator());
the Error is with ForgeMenuButtonCreator() – > error allocating object of an abstract class.
compile error with clang :
unimplemented pure virtual method ‘createForgeCosntruct’ in ‘ForgeMenuButtonCreator’
virtual ForgeConstruct* createForgeCosntruct() const = 0;
It is defined is it not ? Not sure what else to do ?
New contributor
Ronin15 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.