title: Storing classes in boost::variant
body: <p>Someone recommended me to use boost::variant as shape variable to store different types of shapes in it. But, when implemented boost::variant to my code, I got an error while compiling. Error says: 'Shape': base class undefined and more errors.</p>
  
  <p>Here is my code (Object.h):</p>
  
  <pre><code>using Shape = boost::variant&lt;Rectangle, Circle&gt;;
  
  enum Shape_Type
  {
      RECTANGLE,
      CIRCLE
  };
  
  struct Position
  {
      float x, y;
  
      Position(float position_x, float position_y)
      {
          x = position_x;
          y = position_y;
      }
  };
  
  class Object : private Shape
  {
  
  private:
      std::string name;
  
  public:
      Object() = default;
  
      Object(std::string name, Rectangle rectangle) : name(name), Shape(rectangle)
      {
      }
  
      Object(std::string name, Circle circle) : name(name), Shape(circle)
      {
      }
  
      void setPosition(float, float);
  
      void setAngle(float);
  
      Shape* getShape()
      {
          Shape* shape = this;
          return shape;
      }
  
      Position getPosition();
  
      const std::string* getName()
      {
          return &amp;name;
      }
  };
  
  class Rectangle
  {
  
  private:
      sf::RectangleShape rectangleshape;
  
  public:
      Rectangle() = default;
  
      Rectangle(float width, float height)
          : rectangleshape(sf::RectangleShape(sf::Vector2f(width, height)))
      {
      }
  
      void setPosition(float position_x, float position_y)
      {
          rectangleshape.setPosition(position_x, position_y);
      }
  
      void setAngle(float angle)
      {
          rectangleshape.setRotation(angle);
      }
  
      sf::RectangleShape* getRectangleShape()
      {
          return &amp;rectangleshape;
      }
  
      Position getPosition()
      {
          return Position(rectangleshape.getPosition().x,
                          rectangleshape.getPosition().y);
      }
  };
  
  class Circle
  {
  
  private:
      sf::CircleShape circleshape;
  
  public:
      Circle() = default;
  
      Circle(std::string name, float radius)
          : circleshape(sf::CircleShape(radius))
      {
      }
  
      void setPosition(float position_x, float position_y)
      {
          circleshape.setPosition(position_x, position_y);
      }
  
      void setAngle(float angle)
      {
          circleshape.setRotation(angle);
      }
  
      sf::CircleShape* getCircleShape()
      {
          return &amp;circleshape;
      }
  
      Position getPosition()
      {
          return Position(circleshape.getPosition().x,
                          circleshape.getPosition().y);
      }
  };
  </code></pre>
  
  <p>And btw is getShape() function good?</p>