#include <iostream>
using namespace std;
class A {
public:
    A() { CoolVirt("A()"); }
    ~A() { CoolVirt("~A()"); }
protected:
    void CoolVirt(const char* str) { f(str); }
    virtual void f(const char* str) = 0;
};
class B: public A {
public:
    B() { CoolVirt("B()"); }
    ~B() { CoolVirt("~B()"); }
protected:
    void CoolVirt(const char* str) { f(str); }
    void f(const char* str) { cout << str << endl; }
};
int main() {
    B b;
    return 0;
}
Login in to like
Login in to comment