const override
时间: 2023-12-10 17:04:44 浏览: 126
详解C++基础——类继承中方法重载
`const` is a keyword in C++ that specifies that a variable or function does not modify the object it is applied to.
`override` is also a keyword in C++ that is used to explicitly declare that a virtual function in a derived class overrides a virtual function in the base class. This keyword helps prevent mistakes in the code and ensures that the intended function is being overridden.
When used together, `const override` specifies that a virtual function in a derived class does not modify the object it is applied to and overrides a virtual function in the base class.
阅读全文