Is there any way to restrict a class to create only 2 objects

I know about singleton object design pattern.
How to allow a class to create only 2 different objects, then it should throw a error.


Source: oop

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.