Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences among final, finally and finalize in C++

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the differences between final, finally and finalize in C++. It has certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article. Let the editor take you to know it.

The specification character final is provided by the Clear11 standard. It is important to note that the final in Candles11 is not a keyword, but a specifier, which means that you can use it (without causing confusion) as an identifier (to be compatible with previous code). The keyword final, which has the meaning of "this is immutable" or "final state", can modify non-abstract classes, non-abstract class member methods, and variables.

The specification 11 standard provides the specifier final to prevent derived classes from overwriting specific virtual methods. Or prevent a class from becoming a base class.

Syntax 1:class Someclass final {...}

Syntax 2:class Someclass {... type somefun (arg-list) final;...}

Class A {private:public:virtual void Test () const final {std::cout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report