You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Decorator.Components;
|
|
|
|
|
using Decorator.Decorators;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
|
|
namespace Decorator
|
|
|
|
|
{
|
|
|
|
|
internal class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Client client = new Client();
|
|
|
|
|
|
|
|
|
|
ConcreteComponent simple = new ConcreteComponent();
|
|
|
|
|
Console.WriteLine("Client: I get a simple component:");
|
|
|
|
|
client.ClientCode(simple);
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
|
|
ConcreteDecoratorA decorator1 = new ConcreteDecoratorA(simple);
|
|
|
|
|
ConcreteDecoratorB decorator2 = new ConcreteDecoratorB(decorator1);
|
|
|
|
|
Console.WriteLine("Client: Now I've got a decorated component:");
|
|
|
|
|
client.ClientCode(decorator2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|