13. 프록시 모드(Proxy Pattern)
4084 단어 Pattern
using System;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
//
Person proxy = new Friend();
proxy.BuyProduct();
Console.Read();
}
}
//
public abstract class Person
{
public abstract void BuyProduct();
}
//
public class RealBuyPerson : Person
{
public override void BuyProduct()
{
Console.WriteLine(" IPhone ");
}
}
//
public class Friend : Person
{
RealBuyPerson realSubject;
public override void BuyProduct()
{
if (realSubject == null)
{
realSubject = new RealBuyPerson();
}
realSubject.BuyProduct();
Console.WriteLine(" ");
this.PreBuyProduct();
this.PostBuyProduct();
}
public void PreBuyProduct()
{
Console.WriteLine(" IPhone ");
}
public void PostBuyProduct()
{
Console.WriteLine(" IPhone ");
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
textpattern nginx 의 rewrite 규칙최근 에 또 소란 을 피 우기 시작 했다. ,제 웹 환경 은 nginx 기반 이기 때문에 인터넷 에서 검색 해 봤 습 니 다. textpattern 은 nginx 의 rewrite 규칙 에서 가장 완벽 한 것 을 찾...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.