Creating the object
The first statement in the function named classMain
reads as follows:
Hello2* ptrToObject = new Hello2();
In layman's terms, this is what that statement means:
- Create a pigeon hole in memory and name it ptrToObject.
- Using the construction blueprints contained in the
definition of the class named Hello2, construct a new object in
memory that complies with those construction blueprints.
(This is analogous to hiring a construction contractor to
build your new house using the blueprints provided by your architect.)
- The new object has an address in memory, which is
analogous to the address of your house. Store that address in the pigeon
hole named ptrToObject. (This is analogous
to registering the address of your new house with the county tax office.)
And that's all there is to the first statement.