using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdapterPattern
{
public interface Print
{
void printWeak();
void printStrong();
}
public class Banner
{
private String memo;
public Banner(String memo)
{
this.memo = memo;
}
public void showWithParen()
{
Console.WriteLine("(" + memo + ")");
}
public void showWithAster()
{
Console.WriteLine("*" + memo + "*");
}
}
public class PrintBanner : Banner, Print
{
public PrintBanner(String memo) : base(memo)
{
}
public void printStrong()
{
showWithParen();
}
public void printWeak()
{
showWithAster();
}
}
class Program
{
static void Main(string[] args)
{
Print print = new PrintBanner("TEST");
print.printWeak();
print.printStrong();
}
}
}
'Programming > Design Pattern' 카테고리의 다른 글
싱글턴 패턴 (0) | 2016.10.19 |
---|---|
SingletonPattern (0) | 2016.10.19 |
PrototypePattern (0) | 2016.10.05 |
BuilderPattern 실습 (0) | 2016.09.28 |