Constructors

Pages: 12
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?
No, not windows. Your compiler creates the code that does that. Windows doesn't have anything to do with it.
Ok:

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?

3. Whats the "s" for at the end?
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.

Whats the "s" for at the end?

In the book? Very likely a print error.
I'm sorry, but how can you have 215posts here and not even recognize a typo like that? :/
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.
Topic archived. No new replies allowed.
Pages: 12