コード例 #1
0
        static int Main(string[] args)
        {
            IDerived id = new Derived();

            if (id.Do() != 2)
            {
                return(1);
            }
            IBase ib = (IBase)id;

            if (ib.Do() != 2)
            {
                return(2);
            }
            Derived d = (Derived)id;

            if (d.Do() != 1)
            {
                return(3);
            }
            Base b = (Base)id;

            if (b.Do() != 1)
            {
                return(4);
            }
            return(0);
        }
コード例 #2
0
 public string Do()
 {
     return("_decorator1" + _decoratee.Do());
 }
コード例 #3
0
 public string Do()
 {
     return("_decoratorWithDependency" + _dependency.Do() + _decoratee.Do());
 }