Skip to main content

Questions tagged [static-access]

in object-oriented programming, access from a static (class) context, as opposed to one from a particular object instance context

1 vote
2 answers
2k views

I'm creating a multi window gui program, in c++ with Qt Widgets. I do have many custom gui elements, which usually are c++ classes inherited from QWidget or other Qt elements. When foo is the main ...
Turtle10000's user avatar
0 votes
3 answers
2k views

The goal within my framework is to provide facades or front-facing functions/APIs so that people can easily interact with my system, as such, in most cases, that goes super well by having static ...
Daniel M's user avatar
0 votes
1 answer
137 views

I have been reading into possible design patterns and have found the use of singletons always referred to as an anti-pattern. I am currently using a singleton for the sole purpose of gathering ...
Necro's user avatar
  • 105
1 vote
1 answer
3k views

I am working on a game, and I have many instances where I have to do something like this: Game.getInstance().getEnergyDropManager().getDrops() Or: this.dimensionSelector.selectDimension(Game....
MCMastery's user avatar
  • 173
37 votes
3 answers
7k views

Kotlin is known primarily as a drop-in replacement for Java, but it gets rid of a well-known Java construct: the static keyword. Instead, that class-level functionality is offered mainly by companion ...
user1446's user avatar
  • 492
5 votes
1 answer
2k views

While working on a project, I decided to create a database class to manage my DB connection. I started looking for the best practice to do that, which is usually either a static class or a singleton ...
Wisam Shaker's user avatar
1 vote
1 answer
5k views

Pre: I am looking at a quite big PHP project developed by a company which we need to partly interact with while building a new webapp. The whole application is developed in PHP 5. Most of the ...
GavinoGrifoni's user avatar
0 votes
0 answers
168 views

Question background: I have an e-commerce site I'm developing that requires multiple controller methods to access a single session variable. The idea: My idea was to create a singleton style class ...
user1352057's user avatar

15 30 50 per page