유니티
[C#] 제네릭
simstealer
2024. 4. 16. 14:08
using System.Cllections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class Generic<T>
{
private T data;
public T Test01Generic(T n)
{
return n;
// 여기서 T는 클래스에서 받은 타입
}
// 여기서 G는 함수에서 인자로 받은 값의 타입
public T Test02Generic<G>(G n)
{
T tt = data;
return tt;
}
}