Ok, in my class it defines virtual ~GameEngine();s, so do we have to define this destructor in the gameEngine class so that if an object goes out of scope windows will call upon this SPECIFIC function?
1. And if we didnt define virtual ~GameEngine();s a default one would be provided?
2. Is the purpose of virtual functions to have different functionality in derived classes as virtual functions can be over-ridden? Could you give me an example of why we make the destructor virtual?
And if we didnt define virtual ~GameEngine();s a default one would be provided?
No. Well, there would be a default constructor, but it would not do anything and would not be virtual.
Is the purpose of virtual functions to have different functionality in derived classes as virtual functions can be over-ridden? Could you give me an example of why we make the destructor virtual?
Derived classes can have new member fields that would not be destructed if the derived class did not have an own destructor.
The number of posts is counted from how many posts the person has made, not how much they know about programming or C++. And we don't appreciate that attitude here, so please stop.