Is there something like Java annotations in C ++?
For example, the @Override annotation marks a function that overrides another function, and if it weren’t, it would give an error at compile time.
I am looking for something similar in C ++.
C ++ 0x will have this function, where you can explicitly indicate whether a member function is intended to override a base class function, use the default implementation generated by the compiler, and much more.
++ 11 , Java, /, , , . ++ 11 , .
: http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generalized-attributes/
GCC 4.8, : http://gcc.gnu.org/projects/cxx0x.html
, , , https://fedorahosted.org/gcc-python-plugin/
++ 0x, "". , "Java-" , , , :
class Base { public: virtual void foo() = 0; }; class Extended : public Base { public: void foo2() { cout << "hi" << endl; }; int main() { Extended e; e.foo(); }
, foo . , , , .
. , , , . "" .
Source: https://habr.com/ru/post/1780611/More articles:Admob orientation support for Android - androidFilter data in ListView [mvvm] - c #Why does the compiler think that this variable is not constant? - c ++Adding annotation syntax to a C ++ source - c ++General question with the question of returning to C # - c #Не удается запустить powerpoint из ярлыка меню запуска в С# - c#Does Android cursor look at all database paths? - androidcss for inline editing - jqueryкак выбрать только одно конкретное поле из модели в zend framework - zend-db-tableJava Application Container - javaAll Articles