35. Service developer’s “stub” object(s) c lass Mentos : IReactiveSubstance { public string ReactiveSubstance() { return "Caffine"; } public void React() { throw new NotImplementedException(); } } Interface Contract public interface IReactiveSubstance { string ReactiveSubstance(); void React(); } c lass DietPepsi : IReactiveSubstance { public string ReactiveSubstance() { return "Natural Flavors"; } public void React() { throw new NotImplementedException(); } }
36. class Bottle { private IReactiveSubstance _Liquid; private IReactiveSubstance _ObjectThatDoesntBelongHere; public Bottle( IReactiveSubstance liquid, IReactiveSubstance candy) { _Liquid = liquid; _ObjectThatDoesntBelongHere = candy; } public string Combine() { _Liquid.React(); _ObjectThatDoesntBelongHere.React(); return _Liquid.ReactiveSubstance() + _ObjectThatDoesntBelongHere.ReactiveSubstance(); } } Consumer developer’s code implementing and manipulating a n d m a n i p u l a t i n g both objects