嗨,我們如何在實時場景中實現接口?接口實現時不透露實現接口的類
這是我的情況
我已經有2種方法
void SaleTransaction();
void VoidTransaction();
接口IPayPal現在我有一個類的PayPal,將實現該服務。
class PayPal:IPayPal{
public void SaleTransaction(){
// Implementation happens here
}
public void VoidTransaction(){
// Implementation happens here
}
}
現在我有一個來自PayPal
請求服務的服務讓說
class Service{
IPayPal pp=null;
static void Main(){
pp=new PayPal();
//Now i do not want to expose all the methods in my class PayPal
// is there any other way to just show pp.SaleOneTransaction() method?? i donot want the //PayPal class to be present in this Program..
//Please tell me how to acheive this.
}
}
即請告訴我的方式。我在初始化我的接口類不透露類實現接口。
感謝