Incorrect. Protected means unavailable outside this class, except to
subclasses. What definition of "protected" are you using?
In Java, protected means available to:
1. methods (class [static] or instance) of this class and objects of this =
class
2. methods (class [static] or instance) of subclasses of this class
and objects of those subclasses
3. methods (class [static] or instance) of classes defined in the same
package as this class, and objects of those classes
In Java private means available to:
methods (class [static] or instance) of this class and objects of this clas=
s
In C++, protected means available to:
members and friends of the base class in which the protected member is
defined, and members and friends of any classes derived from that base
class.
In C++, private means availabe to:
members and friends of the base class in which the protected member is defi=
ned.
In Ruby, an instance variable can be directly accessed from:
methods of the object in which it exists, regardless of on which class
or module those methods are defined.
This is far more restrictive than protected access in Java and C++,
and simultaneous more restrictive (does not allow methods on other
objects -- including objects of the same class and the object which is
the class -- to access instance variables of an object) and less
restrictive (allows instance methods on the same object to access
instance variables of the object even when those methods were not
defined in the same class/module.)
I stand by the characterization that access to Ruby instance variables
is more like private access than protected access; in fact, its
pretty much identical to private access for methods in Ruby, which
differs from languages like Java and C++ in that private access
restricts based on the specific object, not the class. Its certainly
unlike Ruby protected access, which allows access to members from
members of other instances of subclasses of the class of which the
object is a class.