4
Reply

Is it possible to restrict object creation?

Mukesh Kumar

Mukesh Kumar

8y
429
0
Reply
    make your constructor private which is known as singleton pattern. Where there will be only one object created by developer.
    Yes By throwing error in constructer
    Yes, By throwing error
    make your constructor private which is known as singleton pattern. Where there will be only one object created by developer.