Public Class Lawyer
{
private IInfoSend infoSend;
public IInfoSend setInfoSend(IInfoSend infoSend)
{
this.infoSend=infoSend;
}
public void sendMsg()
{
this.infoSend.sendMsg(this.entity);
}
}
Public Interface IInfoSend
{
void sendMsg();
}
public class BJInfoSendImp implement IInfoSend
{
private Ithird third;
public void setIthird(Ithird third)
{
this.third=third;
}
override void sendMsg()
{
third.doSomething();
}
}
void main()
{
BJInfoSendImp infosend=new BJInfoSendImp();
Ithird
third=new Third();
infosend.
setIthird(
third
);
Lawyer law=new Lawyer();
law.setInfoSend(infosend); law.sendMsg();}