gpt4 book ai didi

c# - 如何关联客户和付款明细

转载 作者:行者123 更新时间:2023-11-30 22:47:13 24 4
gpt4 key购买 nike

我有一个与对象之间的关系相关的查询。

场景:

付款详情 -A。信用卡b.储蓄账户C。支票

现在,客户在购买任何产品之前应了解上述任何付款详情。我如何将付款细节与客户联系起来。

任何人都可以用例子解释......

提前致谢。

最佳答案

public interface IPaymentType 
{
bool Pay(double amount);
}

public class CreditCardPType : IPaymentType
{
double limit;
// implement Pay()
}
public class Cheque: IPaymentType
{
int accountNumber;
// implement Pay()
}

public class Customer
{
public IPaymentType paymentType { get; set; }
}


Customer customer = new Customer();
customer.paymentType = new CreditCardPType();

关于c# - 如何关联客户和付款明细,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2317111/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com