Hello,
I created custom shape for my project and when I want to call object of this class i get an error: Object of abstract class "dcad::DimensioningLine" is not allowed pure virtual function "sf::Shape::getPoint()" has no overrider.
Here is the code:
#ifndef DCAD_DIMENSIONINGLINE_H
#define DCAD_DIMENSIONINGLINE_H
#include "SFML/Graphics.hpp"
namespace dcad
{
class DimensioningLine : public sf::Shape
{
public:
explicit DimensioningLine(const sf::Vector2f& size = sf::Vector2f(0, 0)) :
m_size(size)
{
update();
}
void setSize(const sf::Vector2f& size)
{
m_size = size;
update();
}
const sf::Vector2f& getSize() const
{
return m_size;
}
virtual std::size_t getPointCount() const
{
return 10;
}
virtual sf::Vector2f getPoint(unsigned int index) const
{
float x, y;
switch (index)
{
default:
case 0: return sf::Vector2f(x, y);
case 1: return sf::Vector2f(x + 7, y + 7);
case 2: return sf::Vector2f(x + 14, y);
case 3: return sf::Vector2f(x + 7, y + 7);
case 4: return sf::Vector2f(x + 7, y - 7);
case 5: return sf::Vector2f(x + 7 + m_size.x, y);
case 6: return sf::Vector2f(x + 7 + m_size.x, y + 7);
case 7: return sf::Vector2f(x + m_size.x, y);
case 8: return sf::Vector2f(x + 7 + m_size.x, y + 7);
case 9: return sf::Vector2f(x + 14 + m_size.x, y);
}
}
private:
sf::Vector2f m_size;
};
}
#endif DCAD_DIMENSIONINGLINE_H
Anyone knows why am I getting this error ?