Ahh I get it that makes sense thanks quzah, and thanks Cat for trying. :)
Printable View
Ahh I get it that makes sense thanks quzah, and thanks Cat for trying. :)
The moment of creation for an object is when the code that resulted from the declaration or new call gets executed. In both cases the code FIRST allocates memory and THEN calls the constructor, passing a pointer to that memory as this pointer. The memory holds random content at that time, but that gets changed in the constructor.Quote:
Is it really that simple? If the constructor were a part of the object, how could it be used to construct that very object ?
In effect, constructors and destructors are there to help the "blackbox" aspect of a class, to make a class a self-contained entity.