public ATMDispenseChain() { //init the chain this.c1 = new Dollar50Dispencer(); IDispenseChain c2 = new Dollar20Dispenser(); IDispenseChain c3 = new Dollar10Dispenser(); //set the chain c1.setNextChain(c2); c2.setNextChain(c3); }
public ATM() { // initialize the chain var c100 = new DollarBill(100); var c50 = new DollarBill(50); var c20 = new DollarBill(20); var c10 = new DollarBill(10); c100.Next = c50; c50.Next = c20; c20.Next = c10; _chain = c100; }
public void setNextChain(IDispenseChain nextChain) { this.chain = nextChain; }
public void SetNextChain(IDispenseChain nextChain) => chain = nextChain;