Spot the bug in JsonDecoder override

from Virtual functions
C++23 intermediate 4 min 1 issue to find

Find why calls through Decoder& do not use JsonDecoder.

C++
#include <string>
#include <string_view>

class Decoder {
public:
    virtual std::string decode(std::string_view input) const {
        return std::string(input);
    }
    virtual ~Decoder() = default;
};

class JsonDecoder final : public Decoder {
public:
    std::string decode(std::string_view input) {
        return "json:" + std::string(input);
    }
};
Open in playground
Report an error