본문 바로가기
STUDY/디자인패턴

Proxy 프록시 패턴

by 램플릿 2024. 7. 15.

메모리에 항상 올려두고싶지는 않은데 가끔씩 사용함

쓰다가 반환하는 방식

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Proxy1
{
    // 1000 1gb
    public void Load()
    {
        
    }

    public void Unload()
    {
        
    }
}

public class ProxyPatternExample : MonoBehaviour
{
    private Proxy1 proxy1 = null;

    public void ProxyLoad()
    {
        proxy1 = new Proxy1();
        proxy1.Load();
    }

    public void ProxyUnload()
    {
        if (proxy1 != null)
            proxy1.Unload();

        proxy1 = null;
    }
}

'STUDY > 디자인패턴' 카테고리의 다른 글

Command 커맨드 패턴 ★★★  (0) 2024.07.16
chain of responsibility 책임연쇄 패턴  (0) 2024.07.16
Flyweight 플라이웨이트 패턴  (0) 2024.07.15
추상 팩토리 패턴  (0) 2024.07.12
Singletone 싱글톤 패턴 ★★★  (0) 2024.07.12