本文介绍了c ++密封和接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,在C ++中有密封和接口关键字。这是CLR C ++吗?
如果没有,当被密封和接口添加到C ++标准?它们在C ++中有与在C#中相同的意义吗?

I noticed that there are sealed and interface keywords in C++. Is this just for CLR C++?If not, when were sealed and interface added to the C++ standard? Do they have the same meaning in C++ as they do in C#? If not, how do I get the equivalent in standard C++?

推荐答案

密封 interface 关键字仅用于C ++ / CLI。有关详情,请参见详细信息。

sealed and interface keywords are only for C++/CLI. See Language Features for Targeting the CLR for more details.

在标准C ++ 接口中,可以替换为纯虚拟类和多重继承。 密封的关键字可以替换为(这不是boost的官方部分)。

In standard C++ interface could be replaced with pure virtual class and multiple inheritance. Sealed keyword could be replaced with boost::noninheritable (which is not an official part of boost yet).

这篇关于c ++密封和接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-27 16:09