error C3662: override specifier 'new' only allowed on member functions of managed classes
- by William
Okay, so I'm trying to override a function in a parent class, and getting some errors. here's a test case
#include <iostream>
using namespace std;
class A{
public:
int aba;
void printAba();
};
class B: public A{
public:
void printAba() new;
};
void A::printAba(){
cout << "aba1" << endl;
}
void B::printAba() new{
cout << "aba2" << endl;
}
int main(){
A a = B();
a.printAba();
return 0;
}
And here's the errors I'm getting:
Error 1 error C3662: 'B::printAba' : override specifier 'new' only allowed on member functions of managed classes c:\users\test\test\test.cpp 12 test
Error 2 error C2723: 'B::printAba' : 'new' storage-class specifier illegal on function definition c:\users\test\test\test.cpp 19 test
How the heck do I do this?