、、などの各支払いモードのクラスがありCash
ます。関連するクラスをインスタンス化する必要があるオブジェクト値に基づいて、オブジェクトをパラメーターとして渡す必要があります。Cheque
Card
どうすればこれを達成できますか?より良いデザインを提案してください
public interface CollectionInfo {
//Code Goes here
}
public class Cash implements CollectionInfo {
//Code goes here
}
public class CollectionFactory {
public void newInstance(Enum<CollectionMode> collectionMode) {
}
}
public interface Receipts {
public Receipt createReceipt(String Amount, /*(Here i need to pass parameter of object either cash ,Cheque or card),*/Date date);
}