#include<iostream>
using namespace std;
struct Abstract {
virtual void pure() = 0;
virtual void impure() { cout << " Abstract :: impure() " << endl; }
Abstract() {
impure();
pure(); // warning. technically undefined
}
~Abstract() {
impure();
pure(); // warning. technically undefined
}
};
void Abstract :: pure() { cout << " Abstract :: pure()" << endl; }
struct X : public Abstract {
virtual void pure() { cout << " X :: pure() " << endl; }
virtual void impure() { cout << " X :: impure() " << endl; }
};
int main() {
X x;
x.pure();
x.impure();
}
ICAgICNpbmNsdWRlPGlvc3RyZWFtPgogICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDsKICAgIAogICAgc3RydWN0IEFic3RyYWN0IHsKICAgICAgICAgICAgdmlydHVhbCB2b2lkIHB1cmUoKSA9IDA7CiAgICAgICAgICAgIHZpcnR1YWwgdm9pZCBpbXB1cmUoKSB7IGNvdXQgPDwgIiBBYnN0cmFjdCA6OiBpbXB1cmUoKSAiIDw8IGVuZGw7IH0KICAgICAgICAgICAgQWJzdHJhY3QoKSB7CiAgICAgICAgICAgICAgICAgICAgaW1wdXJlKCk7CiAgICAgICAgICAgICAgICAgICAgcHVyZSgpOyAvLyB3YXJuaW5nLiB0ZWNobmljYWxseSB1bmRlZmluZWQKICAgICAgICAgICAgfQogICAgICAgICAgICB+QWJzdHJhY3QoKSB7CiAgICAgICAgICAgICAgICAgICAgaW1wdXJlKCk7CiAgICAgICAgICAgICAgICAgICAgcHVyZSgpOyAvLyB3YXJuaW5nLiB0ZWNobmljYWxseSB1bmRlZmluZWQKICAgICAgICAgICAgfQogICAgfTsKICAgIHZvaWQgQWJzdHJhY3QgOjogcHVyZSgpIHsgY291dCA8PCAiIEFic3RyYWN0IDo6IHB1cmUoKSIgPDwgZW5kbDsgfQogICAgc3RydWN0IFggOiBwdWJsaWMgQWJzdHJhY3QgewogICAgICAgICAgICB2aXJ0dWFsIHZvaWQgcHVyZSgpIHsgY291dCA8PCAiIFggOjogcHVyZSgpICIgPDwgZW5kbDsgfQogICAgICAgICAgICB2aXJ0dWFsIHZvaWQgaW1wdXJlKCkgeyBjb3V0IDw8ICIgWCA6OiBpbXB1cmUoKSAiIDw8IGVuZGw7IH0KICAgIH07CiAgICBpbnQgbWFpbigpIHsKICAgICAgICAgICAgWCB4OwogICAgICAgICAgICB4LnB1cmUoKTsKICAgICAgICAgICAgeC5pbXB1cmUoKTsKICAgIH0=