这段程序会输出什么?

来自 虚函数
C++23 高级 2分钟

这段程序会输出什么?

C++
#include <iostream>

class Sender {
public:
    virtual void send(int priority = 1) const {
        std::cout << "base:" << priority << '\n';
    }
    virtual ~Sender() = default;
};

class EmailSender final : public Sender {
public:
    void send(int priority = 2) const override {
        std::cout << "email:" << priority << '\n';
    }
};

int main() {
    EmailSender email;
    Sender& sender = email;
    sender.send();
    email.send();
}
在试验场中打开
报告错误