Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can a class have only one instance?

class instance
0
Posted

Can a class have only one instance?

0

Yes. Again, there is no problem as far as the formalism goes. An empty table or a table that always contains only one instance is perfectly fine. If there is always one instance, you have to ask why. Many times it is because the functions at the focus of your interest only apply to one instance. But, as you extend your scope, it becomes apparent that more than one instance is possible. If we are building a control system for an inspection station, we may know there is only ever one station. But the minute we extend this system to networked control of many stations, more instances are entered into the table. It is also possible that you have a useless class that really shouldn’t be a class.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123