I have a question - is it normal to make Array public in singelton, if you need access to it or do something else?

  • singelton - implies that the program should have only 1 copy of the object, if in your prog it is a critical area - do it alone - Gorets
  • @Gorets I know what singelton is, I wonder if I make an array in it and I want to have access to it - do I make it public or use something else? - Pavel
  • I think you confuse the scope of an object with the number of copies in the program - Gorets
  • make it public =) - Gorets
  • And what's the problem to make a public array? This does not violate the concept of singletone - Zowie

1 answer 1

I don’t know why) just to know interstno..do not violate the principles of the OOP

If you strictly follow the rules of the PLO , it is impossible. If you need to read some property from the outside, you need to do getter, if you also change it, also setter. And so everywhere.