Proxy Pattern Demo : Proxy Pattern : Design Patterns C# Source Code


Custom Search

C# Source Code » Design Patterns » Proxy Pattern »

 

Proxy Pattern Demo








    
 

using System;

public interface IEmployee {
    string Design();
    string StressTest();
    string Mechanical();
    string Performance();
}

public class ChiefDesignEngineer : IEmployee {

    public string Design() {
        return "Design ";

    }

    public string StressTest() {
        return "Stress Test";
    }

    public string Mechanical() {
        return "mechanical";
    }

    public string Performance() {
        return "performance";
    }

    public ChiefDesignEngineer() { ;}
}


public class ProxyChiefDesignEngineer : IEmployee {
    private ChiefDesignEngineer chief;

    public string Design() {
        return this.chief.Design();
    }

    public string StressTest() {
        return this.chief.StressTest();
    }

    public string Mechanical() {
        return "supplement to mechanical.";
    }
    public string Performance() {
        return "Performance for Chief Design Engineer";
    }
    public ProxyChiefDesignEngineer() {
        this.chief = new ChiefDesignEngineer();
    }

}

public class Client {

    static void Main(string[] args) {
        ProxyChiefDesignEngineer caProxyChief = new ProxyChiefDesignEngineer();

        Console.WriteLine(caProxyChief.StressTest());

        Console.WriteLine(caProxyChief.Performance());

        ProxyChiefDesignEngineer nyProxyChief = new ProxyChiefDesignEngineer();

        Console.WriteLine(nyProxyChief.Mechanical());

    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Design Patterns
» Proxy Pattern