Information is not hidden and can be used anywhere in the program.
An instance method is declared inside a class definition and is intended for use by a specific object or ‘instance’ of the class
The method-call itself has nothing to do with the change of the object. You can verify this by running this exxample. This simply passes the num object to the change method and returns it
Most of the time, Ruby methods come with two access points – like the doors into and out of a room. The argument list provides the way in; the return value provides the way out.
In most modern OOP languages such as Java and C#, encapsulation and informa-tion hiding are not rigorously enforced.
Learn how to calculate no of elements in an array and how to work with a specific array element.
By default (as defined in Ruby’s Kernel module) a test using == re-turns true when both objects being tested are the same object.
In some cases, a method may need to be capable of receiving an uncertain number of arguments – say, for example, a method which processes a variable length list of items.
Example of the string concatena-tion method, <<, which, just like those methods that end with !, modifies the receiver object without creating a new object