Interviews4 answers
Is it possible to restrict object creation?
4 Answers
Yes
Shiva MogilicharlaPosted May 25, 2018, 5:12 AM EDT
make your constructor private which is known as singleton pattern. Where there will be only one object created by developer.
Yogesh SoppaPosted Nov 22, 2017, 3:05 AM EST
make your constructor private which is known as singleton pattern. Where there will be only one object created by developer.
Yogesh SoppaPosted Nov 22, 2017, 3:05 AM EST
Yes
By throwing error
in constructer
Mukesh KumarPosted Sep 4, 2017, 9:58 AM EDT

