I have a class which I only want to expose access from its own DLL. However, another class from this DLL is creating an instance of that class. Then, from that instance, that class exposes a method or a property of the class that should not be available outside the DLL.
So, lets say a class is creating an instance of the other class as:
Public oUpload As Framework.Upload = New Framework.Upload(oProcess)
And, this class can expose oUpload to the application as it is public. So, the application can then do things like this:
loImport.cSource = oUpload.cFile
So, at this point, the Upload class is defined Public and the other class creating an instance of it is declaring oUpload as Public. Thus, the application can gain access to the Upload methods and properties which are public.
Having said that, it means the application can create an instance of the Upload class. This is what I do not want. If I put Friend for the class declaration, this will allow the other class to create an instance of it but will not allow the other class to declare oUpload as Public.
Is there a way to negotiate with that need?