C# Interfaces

  • Thread starter Thread starter Nando
  • Start date Start date
N

Nando

I have set of objects working together in the classic client-server way.
The server in other to do its work requieres the clients to implement an
interface.

However the client objects perform several tasks in other components of the
program and the use of those interface methods outside the server is not
appropiate, is it posible to hide the interface implementation to objects
other than the server object?

Thanks in advance,

Atte:
Nando
 
Hi,
The server in other to do its work requieres the clients to implement an
interface.

Sounds a little bit strange until the server needs to call back the clients.
However the client objects perform several tasks in other components of the
program and the use of those interface methods outside the server is not
appropiate, is it posible to hide the interface implementation to objects
other than the server object?

You can declare an interface containing all the methods expected by the
server. The client classes will implement this interface, and the server
class will be talking to the client classes only through the interface
declared. The rest of the methods in the client classes can be declared as
internal and therefore won't be visible outside the assembly containing the
client classes.
 
Back
Top