#include <iostream>
using namespace std;
template <const int EVENT>
class Special {
public:
virtual ~Special() = default;
protected:
Special() {
call();
}
virtual void call() = 0;
};
class Test : public Special<0>, public Special<2> {
private:
void call() override;
};
template<>
void Test::Special<0>::call() {
cout << "Call to Special<0>'s call" << endl;
}
template<>
void Test::Special<2>::call() {
cout << "Call to Special<2>'s call" << endl;
}
int main() {
Test t; // Calls constructors
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGUgPGNvbnN0IGludCBFVkVOVD4KY2xhc3MgU3BlY2lhbCB7CiAgcHVibGljOgoJdmlydHVhbCB+U3BlY2lhbCgpID0gZGVmYXVsdDsKCQogIHByb3RlY3RlZDoKCVNwZWNpYWwoKSB7CgkJY2FsbCgpOwoJfQoJdmlydHVhbCB2b2lkIGNhbGwoKSA9IDA7Cn07CgpjbGFzcyBUZXN0IDogcHVibGljIFNwZWNpYWw8MD4sIHB1YmxpYyBTcGVjaWFsPDI+IHsKICBwcml2YXRlOgoJdm9pZCBjYWxsKCkgb3ZlcnJpZGU7Cn07Cgp0ZW1wbGF0ZTw+CnZvaWQgVGVzdDo6U3BlY2lhbDwwPjo6Y2FsbCgpIHsKCWNvdXQgPDwgIkNhbGwgdG8gU3BlY2lhbDwwPidzIGNhbGwiIDw8IGVuZGw7Cn0KCnRlbXBsYXRlPD4Kdm9pZCBUZXN0OjpTcGVjaWFsPDI+OjpjYWxsKCkgewoJY291dCA8PCAiQ2FsbCB0byBTcGVjaWFsPDI+J3MgY2FsbCIgPDwgZW5kbDsKfQoKaW50IG1haW4oKSB7CglUZXN0IHQ7ICAvLyBDYWxscyBjb25zdHJ1Y3RvcnMKCXJldHVybiAwOwp9