public vs protected vs private
Category:
public
Can be called by any object. Default for methods.
protected
Can be called by objects of the defining class and its subclasses.
private
Can be called only by current object. The object sends message to itself. The receiver is always self
and it can’t be set explicitly even with self
keyword. initialize
method is always private.