Prevention of a client from directly instantiating my concrete classes

91 views Asked by At

How would you prevent a client from directly instantiating your concrete classes?

For example, you have a Cache interface and two implementation classes MemoryCache and DiskCache, How do you ensure there is no object of these two classes is created by the client using the new() keyword.

Thanks

0

There are 0 answers