public class Manager where T : Base
{
T apple = new T(10);
}
์ด๋ฐ์์ผ๋ก Tํ์ ์ ์ธํ ๋ ๋งค๊ฐ๋ณ์์๋ ์์ฑ์๋ฅผ ๊ฐ์ ํ๊ณ ์ถ์๋ฐ
----------------------------------
public class Base
{
int a;
public Base(int _a)
{
a=_a;
}
}
๊ทธ๋ฅ์๊ฐํ๊ธฐ๋ก๋ ์ด๋ฐ ์ ์ฝ์กฐ๊ฑด์ ์ค์ ํด์ฃผ๋ฉด ๋ ๊บผ๊ฐ์๋๋ฐ ์๋๋ค
ํ๋๋ค ์ด๊ฑฐ ์ด์ผํ์ฃ
public class Manager<T> where T : Base ์คํ๋จ
๋งค๊ฐ๋ณ์์๋ ์์ฑ์๋ง ๋๋๊ฑธ๋ก ์ - dc App
Base ์ Init ํจ์ ๋ง๋ค์ด์ ๊ฑฐ๊ธฐ์ ์ด๊ธฐํ ํ๋๊ฑด ์ด๋?
๋น ๊ทธ๋ ๊ฒ ํด๊ฒฐํ์ต๋๋ค