S
Sohum
Hi
I'm reasonably new to this group, and to programming in general.
I'd like to know, can you selectively scope within an interface?
For example:
Public Interface MyInterface
Friend Property X as MyX
Public Method Y
End Interface
.... except you're not allowed to put the scoping keywords there.
Currently, I have a workaround as
Public Interface MyInterface
Property X as MyX
Method Y
End Interface
Public Class MyX
Friend...
Friend...
Friend...
End Class
Public Class ImplementerOfMyInterface
Implements MyInterface
....
Friend Property X as MyX Implements MyInterface.MyX
....
End Class
So, even though the MyX is visible in the public scope, its members are
friend, so outside clients can see that a MyX exists (when accessing through
the interface), but they cannot do anything to it.
My question is, this works in this example where the member to be restricted
is a property whose class members I can control the visibility of. What
happens if I want this interface to be usable everywhere, but
outside-assembly users cannot see a method? or an event? or a class that I
have no control over? Would I have to wrap them in a class? What if I can't
(tightly coupled to class it is in right now)?
So, does a solution exist?
Sohum
I'm reasonably new to this group, and to programming in general.
I'd like to know, can you selectively scope within an interface?
For example:
Public Interface MyInterface
Friend Property X as MyX
Public Method Y
End Interface
.... except you're not allowed to put the scoping keywords there.
Currently, I have a workaround as
Public Interface MyInterface
Property X as MyX
Method Y
End Interface
Public Class MyX
Friend...
Friend...
Friend...
End Class
Public Class ImplementerOfMyInterface
Implements MyInterface
....
Friend Property X as MyX Implements MyInterface.MyX
....
End Class
So, even though the MyX is visible in the public scope, its members are
friend, so outside clients can see that a MyX exists (when accessing through
the interface), but they cannot do anything to it.
My question is, this works in this example where the member to be restricted
is a property whose class members I can control the visibility of. What
happens if I want this interface to be usable everywhere, but
outside-assembly users cannot see a method? or an event? or a class that I
have no control over? Would I have to wrap them in a class? What if I can't
(tightly coupled to class it is in right now)?
So, does a solution exist?
Sohum