Inheritance classes draw errors: cannot allocate objects of abstract type



  • I am attempting to create a wrapper for the many Jack Audio library functions that will be binary compatible. The structure is using the base / abstract class model with d_ptr references.

    The base class : jackport.h
    [code]
    class JackPortPrivate;
    class JackPort
    {

    public:
    JackPort(const QString &name, JackPortFlags type);
    virtual ~JackPort();

    protected:
    virtual void setData(void *data, quint32 nFrames) = 0;
    // this function is called by the jack thread
    // Implement it to implement your own port
    // param: data the buffer that jack provide. It is valid until the function returns
    // param: nFrames the number of frames in data
    //
    JackPortPrivate *const d_ptr;
    JackPort(JackPortPrivate &dd);

    private:
    friend class QJackClient;
    friend class QJackClientPrivate;
    Q_DECLARE_PRIVATE(JackPort)
    };
    [/code]

    The derived class is:
    [code]
    #include "jackport.h"

    namespace QJack
    {
    class JackInPort : public JackPort
    {
    // Inherit from this class if you want to create your own inport

    public:
    JackInPort(QString &name);
    };
    } // namespace
    [/code]

    used as : in_port = new QJack::JackInPort("inport", client->nFrames() * 2, client); (supplied code is not complete)

    Some of the background for this is in the KDE-technical article on Binary Compatibility Future Strategies found here: http://techbase.kde.org/Policies/Library_Code_Policy and here: http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++.

    What am I missing?



  • <code>JackInPort</code> does not implement <code>void setData(void *data, quint32 nFrames)</code> and therefore is an abstract type due to the base <code>JackPort</code> beeing an abstract type as well.



  • Thank you Lukas ... I have been able to proceed with it now.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.