CSC/ECE 517 Fall 2011/ch1 2b qu: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
= Why Access Control? = | = Why Access Control? = | ||
= Access control in different o-o languages = | = Access control in different o-o languages = | ||
== C++ == | === C++ === | ||
== JAVA == | === JAVA === | ||
== | === Smalltalk === | ||
== Eiffel == | === Eiffel === | ||
== Ruby == | === Ruby === | ||
= What are accessor methods? = | = What are accessor methods? = | ||
= Accessor methods in different o-o languages = | = Accessor methods in different o-o languages = | ||
== C++ == | === C++ === | ||
== JAVA == | === JAVA === | ||
== | === Smalltalk === | ||
== Eiffel == | === Eiffel === | ||
== Ruby == | === Ruby === | ||
= How has access control changed in the recent years? = | = How has access control changed in the recent years? = | ||
= Conclusion = | = Conclusion = | ||
= References = | = References = |
Revision as of 14:13, 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?