CSC/ECE 517 Fall 2011/ch1 2b qu: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 1: Line 1:
= Access Control in o-o Languages =
= Access Control in o-o Languages =
O-o languages have different approaches to controlling access to variables and methods.  Ruby, for example, doesn't allow an object to access the private features of another object, even if the other object is an instance of the same class.  Java 1.0 had a "private protected" access specifier that allowed subclasses to access a variable, but not non-subclasses in the same package.  It was dropped, probably because it was confusing.  Have philosophies about allowing access become more restrictive over the years, as accessor methods have become more prominent?
<i> O-o languages have different approaches to controlling access to variables and methods.  Ruby, for example, doesn't allow an object to access the private features of another object, even if the other object is an instance of the same class.  Java 1.0 had a "private protected" access specifier that allowed subclasses to access a variable, but not non-subclasses in the same package.  It was dropped, probably because it was confusing.  Have philosophies about allowing access become more restrictive over the years, as accessor methods have become more prominent?</i>


= Introduction =
= Introduction =

Revision as of 14:04, 17 September 2011

Access Control in o-o Languages

O-o languages have different approaches to controlling access to variables and methods. Ruby, for example, doesn't allow an object to access the private features of another object, even if the other object is an instance of the same class. Java 1.0 had a "private protected" access specifier that allowed subclasses to access a variable, but not non-subclasses in the same package. It was dropped, probably because it was confusing. Have philosophies about allowing access become more restrictive over the years, as accessor methods have become more prominent?

Introduction