Classes also have two features which are known a as a constructor and a deconstructor. A constructor is used to construct the
values of an object when an object is created and a deconstructor is used to deconstruct the values of that object when that object
is deleted. A contructor is like a function that was specifically developed, as part of the C++ language, just to initialize the
values within an object and perform any other tasks that -you want - to be performed whenever an object gets created(whatever those
tasks may be). A contructor gets called and executed at the point of its -- creation.
A deconstructor is like a constructor except its purpose is to - delete - the values within the object I just mentioned, and
perform any other tasks that you want performed when the object gets deleted.
An object's constructor is automatically called --- when --- it comes into scope(i.e. {}).An object's deconstructor is
automatically called --- when --- it falls out of scope. Variables in C++ can be declared between, I suppose, any set of curly
braces. Braces create scope. You -- have to set up the processes necessary within a constructor and deconstructor in order to do
anything that I just mentioned.
A variable or object variable is created at the place of its declaration between a - pair - of curly braces. It is created when
the computer gets around to reading that part of your program. A variable or object variable is deleted when the program reaches
the matching curly brace.