Is this possible in c# somehow? This is the exact case I need it for:
He (the user) must not be able to create instances of this class. However, I want to be able to create instances of this class inside my project. (hence: internally)
Other classes should be able to inherit from it.
I want to force the user to only use the bigger Sound class.
The big “BUT”: The user must be able to use instances of this class if I give it to him, that’s why I can’t just make it internal and be done with it. Neither can I make it abstract, because I want to make copies myself. I thought about giving the user only interfaces like IChannel back, but that doesn’t solve my problem that he shouldn’t be able to make an instance of Channel. He will still be able to see the class if he looks for it, and if he is adventureous enough even try to create an instance.
But as I mentioned before: I can’t make it abstract because I need to make copies internally.
Appreciate your help!
You should be able to declare the constructor as internal and the class itself as public. That should (I think) give you what you want.