Talk:Encapsulation boundary

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
Line 2: Line 2:
  
 
I still don't see why C++/Java are only about class encapsulation. If you use protected attributes, then it's object encapsulation. I think the private keyword is just a way to protect certain attributes even more (which can be useful but also raises the question whether [http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html?page=1 extends are evil] or not. --[[User:TobiW|TobiW]]
 
I still don't see why C++/Java are only about class encapsulation. If you use protected attributes, then it's object encapsulation. I think the private keyword is just a way to protect certain attributes even more (which can be useful but also raises the question whether [http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html?page=1 extends are evil] or not. --[[User:TobiW|TobiW]]
 +
 +
Using protected attributes allows access to the Object, the class, and the package. There is no way to not have the encapsulation boundaries not drawn around classes. (In this case, the classes inside the package, and any subclasses of the class which has the protected attribute.) Object encapsulation would mean that other Objects (whether of the same or a different Class) cannot access the attribute. The only way to have object encapsulation in Java/C++, is to use the protected attribute, and just set boundaries for yourself as a developer which say "I will not access another object's attributes".
 +
 +
Also, I disagree with the article. I think the examples given by the author are more about [[Inheritance for implementation]], and not inheritance in general. --[[User:Michal Connole|Michal Connole]] 05:14, 30 July 2009 (UTC)
 +
 +
Broken link. Can anyone reupload this file, or fix the link? What was it to? If it's Janina's Honours Dissertation I can do it... -- [[User:Lukas Korsika|Lukas Korsika]] 00:38, 1 October 2010 (UTC)

Latest revision as of 00:38, 1 October 2010

Small fix -- Jason Clutterbuck 22:46, 25 September 2008 (UTC)

I still don't see why C++/Java are only about class encapsulation. If you use protected attributes, then it's object encapsulation. I think the private keyword is just a way to protect certain attributes even more (which can be useful but also raises the question whether extends are evil or not. --TobiW

Using protected attributes allows access to the Object, the class, and the package. There is no way to not have the encapsulation boundaries not drawn around classes. (In this case, the classes inside the package, and any subclasses of the class which has the protected attribute.) Object encapsulation would mean that other Objects (whether of the same or a different Class) cannot access the attribute. The only way to have object encapsulation in Java/C++, is to use the protected attribute, and just set boundaries for yourself as a developer which say "I will not access another object's attributes".

Also, I disagree with the article. I think the examples given by the author are more about Inheritance for implementation, and not inheritance in general. --Michal Connole 05:14, 30 July 2009 (UTC)

Broken link. Can anyone reupload this file, or fix the link? What was it to? If it's Janina's Honours Dissertation I can do it... -- Lukas Korsika 00:38, 1 October 2010 (UTC)

Personal tools