Polymorphism within constructors
In C++, polymorphism does not take place within constructors: #include <iostream> using namespace std; struct Base { Base() { foo(); } virtual ~Base() {} virtual void foo() { cout << “Base::foo()\n”; } }; struct Derived : Base { void foo() { cout…