Top "Encapsulation" questions

In OOP, mechanism for restricting access to some of the object's components or a design principle encouraging decoupling from implementation details.

Difference between Encapsulation and Abstraction

I had an interview today. I had a question from OOP, about the difference between Encapsulation & Abstraction? I replied …

oop encapsulation abstraction
How to access private data members outside the class without making "friend"s?

I have a class A as mentioned below:- class A{ int iData; }; I neither want to create member function …

c++ class private encapsulation data-members
Understanding the difference between __getattr__ and __getattribute__

I am trying to understand the difference between __getattr__ and __getattribute__, however, I am failing at it. The answer to …

python oop encapsulation getattr getattribute
"public" or "private" attribute in Python ? What is the best way?

In Python, I have the following example class : class Foo: self._attr = 0 @property def attr(self): return self._attr @attr.…

python oop properties encapsulation
Private Methods Over Public Methods

I was examining the StringTokenizer.java class and there were a few questions that came to mind. I noticed that …

java encapsulation stringtokenizer private-methods public-method
C#: Difference between List<T> and Collection<T> (CA1002, Do not expose generic lists)

Tried to run Run Code Analysis on a project here, and got a number of warnings that said something like …

c# collections encapsulation
Can I access private members from outside the class without using friends?

Disclaimer Yes, I am fully aware that what I am asking about is totally stupid and that anyone who would …

c++ encapsulation private-members
Encapsulation vs Data Hiding - Java

Interviewer: What is encapsulation and how do you achieve it in Java? Me: Encapsulation is a mechanism to hide information …

java oop encapsulation software-design data-hiding
SQL Server: How to permission schemas?

Inspired by various schema related questions I've seen... Ownership chaining allows me to GRANT EXECUTE on a stored procedure without …

sql-server-2005 sql-server-2008 permissions schema encapsulation
Java: Subpackage visibility?

I have two packages in my project: odp.proj and odp.proj.test. There are certain methods that I want …

java package visibility encapsulation