Skip to content

Erroneous declaration of functions in the class SoundData #33

@Commondor

Description

@Commondor

This is an incorrect function declaration:

    class SoundData
    {
    public:
        virtual bool init(const std::string& filename);
        virtual bool init(const std::vector<uint8_t>& newData);
    };

    class SoundDataWave: public SoundData
    {
    public:
        virtual bool init(const std::vector<uint8_t>& newData) override;
    };

Because some compilers accept std::string for std::vector<uint8_t>. As a result, "virtual bool init (const std::string& filename);" not visible in the classes of the heirs. I suggest changing the name of the function "virtual bool init(const std::vector<uint8_t>& newData);" on "virtual bool initData(const std::vector <uint8_t>& newData);".

For example:

string path = "24-bit.wav";

    // compile error:
SoundDataWave* pSoundDataWave = new SoundDataWave();
pSoundDataWave->init( path );

    // compile ok:
SoundData* pSoundDataWave = new SoundDataWave();
pSoundDataWave->init( path );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions