Where does the 'override' qualifier go with trailing return types?

前端 未结 2 1030
一个人的身影
一个人的身影 2021-01-01 10:24

C++11 has the new override qualifier which can be applied to member functions to assert that they override a virtual function in the base class. C++11 also allo

2条回答
  •  無奈伤痛
    2021-01-01 11:02

    like this:

    class I
    {
        virtual auto Func() -> void = 0;
    };
    
    class C : public I
    {
        auto Func() -> void override;
    };
    

    It works in gcc since 4.8.1:
    https://godbolt.org/z/TbTTwa

提交回复
热议问题