1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream> class Base{ private: int a; public: Base():a(5){ } virtual void print(){ std::cout<<"In base "<<this->a<<std::endl; } } int main(){ Base* b = new Base; b->print(); return 0; }
1 2
Line 15: error: new types may not be defined in a return type compilation terminated due to -Wfatal-errors.