C++: allocating an object of abstract class type

I have an issue I don't manage to solve in C++.

I have a class called SceneNode. In this class, there isn't any virtual function and in the private members, I have a vector of unique_ptr and a raw pointer to a SceneNode object. When try to allocate a new SceneNode, I get the following error: allocating an object of abstract class type "SceneNode".

Here's the code:

    class SceneNode : public  sf::Drawable,
                  public  sf::Transformable,
                  private sf::NonCopyable

    //OVERVIEW: A SceneNode is a node from the scene graph. It represents a graphical element
    //A typical SceneNode is (PARENT, CHILDREN, TRANSFORM)
    //With TRANSFORM containing several information:
    //TRANSFORM.POS = the position of this
    //TRANSFORM.ROTATION = the rotation of this

    //The transformation of this is always relative to its parent
    //Therefore, TRANSFORM.POS is the position of this, relatively to its parent

    //NB: - a SceneNode is not copyable !
    //    - It's an abstract class


    typedef std::unique_ptr<SceneNode> UniquePtr;
    typedef sf::Vector2f               Position;


        //REQUIRES: /
        //MODIFIES: this
        //EFFECTS: initializes this with this_post.PARENT = no parent
        //         and this.CHILDREN = { ÔŽ░ }


    //Public member functions
    void attachChild(UniquePtr child);
        //REQUIRES: child != nullptr
        //MODIFIES: this
        //EFFECTS: if child == nullptr, stops the program;
        //         else, this_post.CHILDREN = this.CHILDREN U { child }

    UniquePtr detachChild(const SceneNode& child);
        //REQUIRES: /
        //MODIFIES: this
        //EFFECTS: if child in this.CHILDREN, this_post.CHILDREN = this.CHILDREN \ child && returns a unique_ptr to the child, don't catch it to let it being freed

    sf::Transform getWorldTransform() const;
        //REQUIRES: /
        //MODIFIES: /
        //EFFECTS: returns the absolute transformation of this

    Position getWorldPosition() const;
        //REQUIRES: /
        //MODIFIES: /
        //EFFECTS: returns the absolute position of this


    SceneNode*             mParent;
    std::vector<UniquePtr> mChildren;


What can I do ? Thanks in advance


It appears you are inheriting from abstract interfaces like sf::Drawable but not implementing the pure virtual functions they define (the draw() function in the case of Drawable). If you implement those functions in your class you should get rid of the compiler errors.

Need Your Help

How do i convert the DevIL in NEHE Lesson07 to Slick libraries?

java opengl lwjgl devil

I'm trying to learn how to use LWJGL libraries. Took me forever to find lessons. I eventually stumbled upon the NEHE lessons that teach OpenGL across many programming languages. I downloaded the LW...

ASP.NET Custom non-self-closing control

c# asp.net custom-controls

When building a custom control, how would you access the content between the opening and closing control tags?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.