Let's say I have an Apple Class
and an AppleFactory
Class.
Nobody should be able to use Apple redApple = new Apple()
. Instead new Apples should only be able to be created from AppleFactory.Create()
.
This mean the Constructor of Apple must be inaccessible for everyone but the AppleFactory Class.
How can this be done?
EDIT: Apple
is more like an AppleModel
. So there is only Properties in there.