The access-modifiers tag has no wiki summary.
6
votes
6answers
452 views
Organizing Class Members in Regards to Access Modifier
If we look at typical implementation of a Class, we usually see the private members defined at the beginning and public( mostly functions and Accessors) defined towards the bottom. Now, is this a ...
5
votes
5answers
275 views
Using a SetProperty method to prevent accidental changes to a property
Is it good/bad practice to do the following:
public class MyClass {
public MyType MyProperty { get; private set; }
public void SetMyProperty(MyType myProperty) {
MyProperty = myProperty;
}
...
2
votes
3answers
254 views
Want to know performance issues of Class types & access modifiers
Someone suggested me to mark classes as SEALED that are not being inherited anywhere. I was using default style and was not concerned with the type of class. At present I don't have a benchmark tool ...
15
votes
3answers
1k views
Why aren't there explicit access modifiers in Python:
If 'explicit is better than implicit', why aren't there explicit access modifiers in Python: Public, Protected, Private, etc.?
I know that the idea is that the programmer should know what to do ...
5
votes
3answers
1k views
Should I use default access modifier or not — Coding practice?
Normally when creating new global variables I do not define its access modifier. So as per java it will adopt property default access modifier. When I'm need to access that variable in out of default ...
3
votes
4answers
331 views
How do you remember encapsulation types for effective use?
I've been attempting to learn C#.NET for the past month or so, and the array of ideas that seems to always trip me up is encapsulation. As this is one of the three pillars of OOP, I feel that I am ...
12
votes
6answers
723 views
Real-world scenarios for protected methods
Today I noticed that I basically never use protected methods in C++ code, because I rarely feel the need to call non-public methods of a parent. I do use protected in Java in the template method ...