Assignment of a Variable to itself does not create a new object
Simple assignment of one variable to another does not create a new object. So let’s assume you have one variable called num and another called num2.
In many procedural programming languages such as Pascal and C and their derivatives there is a clear distinction between arguments passed by value or by reference.
If you think undefined methods are likely to be a problem, you can take avoid-ance measures by testing if a singleton method exists before trying to use it.
you might have noticed that the singleton class seems to be doing something rather similar to a singleton method.
This uses the loop method repeatedly to execute the block enclosed by curly braces. This is just like the iterator blocks
A singleton method is a method which belongs to a single object. A singleton class, on the other hand, is a class which defines a single object. Confused? Me too.
The whole point of a private method is that it cannot be called from outside the scope of the object to which it belongs. So this won’t work
In some cases, you may want to restrict the ‘visibility’ of your methods to ensure that they cannot be called by code outside the class in which the methods occur.