1
vote
3answers
260 views

Why shouldn't an object reference have access to a static member in C#

Context of my question: I am reading C#. Trying to understand Static keyword. I understand that when Static is applied to a member of a class, it can only be modified by the class and not the class ...
0
votes
1answer
72 views

When to used static visibility? [duplicate]

I can't attain the primary used of Static Visibility. My question is why they used static method & properties in this code? class PassHash { // blowfish private static $algo = '$2a'; ...
1
vote
7answers
621 views

Significant amount of the time, I can't think of a reason to have an object instead of a static class. Do objects have more benefits than I think? [closed]

I understand the concept of an object, and as a Java programmer I feel the OO paradigm comes rather naturally to me in practice. However recently I found myself thinking: Wait a second, what are ...
2
votes
3answers
204 views

When to use a Singleton and when to use a static class [duplicate]

I've searched about this here and on StackOverflow and found some differences between the two. But I'm still not sure in what cases one would prefer a Singleton, and in what cases one would choose to ...
25
votes
8answers
4k views

Why have private static methods?

I just wanted to clear up a question I have. What is the point of having a private static method as opposed to a normal method with private visibility? I would have thought an advantage to having a ...
1
vote
3answers
239 views

Why are inheritance and interfaces restricted to instance members?

Disclaimer: I think the rules are almost the same in most OO languages, but since I'm most familiar with C# I'll be relating to this specific language. I think that the use of attributes and ...
4
votes
4answers
830 views

Make methods that do not depend on instance fields, static?

Recently I started programming in Groovy for a integration testing framework, for a Java project. I use Intellij IDEA with Groovy plug-in and I am surprised to see as a warning for all the methods ...