Need for virtual destructor. When you delete a derived class 目的 by 使用 a base class pointer, the destructor call will be an undefined behavior. For example: In the below code, we are creating an 目的 of derived class and assigning to base class pointer. Now …
在本章中,我们将了解什么是虚拟基类以及为什么需要虚拟基类? 我们知道C ++中的钻石问题 #include<iostream> //for more C ++ tutorial visit www.ProDeveloperTutorial.com使用 namespace std; class A { public: void display() …