C++ 中的类 Java 注释 [英] Java-like annotations in C++

查看:26
本文介绍了C++ 中的类 Java 注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C++ 中是否有类似 Java 的注解?

Is there something like Java's annotations in C++ ?

例如,@Override 注解标记了一个函数,它覆盖了另一个函数,如果不覆盖,它会在编译时报错.

For example, the @Override annotation marks a function that it overrides another function, and if it wouldn't, it would give an error at compile time.

我正在 C++ 中寻找类似的东西.

I am looking for something like this in C++.

推荐答案

C++0x 将具有此功能,您可以在其中明确指定成员函数是否旨在覆盖基类的函数、使用编译器生成的默认实现等等.

C++0x will have this feature, where you can explicitly specify whether a member function is meant to override a base class' function, use a default implementation generated by the compiler and much more.

这篇关于C++ 中的类 Java 注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆