You don't have to read all the program. I put the code for destructor in a box which can be easily found. I just want to know if the position of a destuctor does matter in the code ? Like what happens if I place it at the end of my class ?
> Like what happens if I place it at the end of my class ?
It can be placed anywhere in the class.
For a class like this (not designed for inheritance), the destructor should be public.
For any class, the destructor should be fail-safe (should not throw).
So you mean the constructors construct the values of member variables, and then they destruct stuff ? I was afraid placing destructor in the middle of my program might make the program's member functions in public to not be able to access the member variables' values.
...might make the program's member functions in public to not be able to...
Constructors and destructors are functions, even if their syntax slightly diverges from the classic one of functions because they can't return any value, so it's not possible to specify a return value.
Like any function, it doesn't matter neither where you declare it nor where you define it, but only where you invoke it. The constructor is automatically invoked when you initialize an instance of its class, the destructor when that instance is cancelled.
I think JLBorges gave you the best advice.