#include class A { public: virtual A *copy()=0; virtual void fuck()=0; virtual ~A() { std::cout << "Stop fucking around" << std::endl; } }; class B : public A { public: B(int t) : t(t) {} B(const B &src) { t = src.t; } int t; A *copy() override { std::cout << "I am B and I am making a copy of A" << std::endl; return new B(*this); } void fuck() override { std::cout << "Fuck B " << t << " times." << std::endl; } ~B() override { std::cout << "Stop fucking B around" << std::endl; } }; class C : public A { public: C(int t) : t(t) {} C(const C &src) { t = src.t; } int t; A *copy() override { std::cout << "I am C and I am making a copy of A" << std::endl; return new C(*this); } void fuck() override { std::cout << "Fuck C " << t << " times." << std::endl; } ~C() override { std::cout << "Stop fucking C around" << std::endl; } }; int main() { A *ab = new B(233); ab->fuck(); A *ab_copy = ab->copy(); ab_copy->fuck(); A *ac = new C(666); ac->fuck(); A *ac_copy = ac->copy(); ac_copy->fuck(); std::cout << "Address: ab: " << ab << "\tab_copy: " << ab_copy << "\tac: " << ac << "\tac_copy:" << ac_copy << std::endl; delete ab; delete ab_copy; delete ac; delete ac_copy; return 0; }