using System;
namespace Study03
{
public class Button
{
public Action onClick;
public Button()
{
}
public void Click()
{
onClick();
}
}
}
using System;
namespace Study03
{
public class App
{
//생성자
public App()
{
Console.WriteLine("App클래스 생성자 호출됨");
Button btn = new Button();
btn.onClick = () =>{
Console.WriteLine("버튼을 눌렀습니다.");
};
btn.Click();
}
}
}
'게임 알고리즘' 카테고리의 다른 글
3일차 람다식 연습문제5 (0) | 2024.08.16 |
---|---|
3일차 람다식 연습문제4 (0) | 2024.08.16 |
3일차 람다식 연습문제2 (0) | 2024.08.16 |
3일차 람다식 연습문제 1 (0) | 2024.08.16 |
3일차 주말과제 (벌처, 드랍쉽 + 역직렬화) (0) | 2024.08.16 |