文章目录
1.派生类实现的父类虚函数后加上关键字 override 表示重载。
参考:c++11 - virtual? override? or both? C++ - Stack Overflow
如果重载失败,会在编译时报错,这样解决了自己以为重载了,但没有重载的问题。
2.class内的函数打出函数名和类名
代码如下:
#include <iostream>
#define star "*******"
#define intofunc " into function: "
#define intoclass " into class: "
#define exitfunc " exit function: "
#define printFunctionName std::cout << star << intofunc <<__func__<< star << std::endl;
#define printClassNameAndFunctionName std::cout << star <<int