메인메서드
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
Larva larva = new Larva();
Zergling zergling = larva.Transform("저글링");
Console.WriteLine(zergling);
}
}
라바 클래스
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Larva
{
//멤버 변수
//생성자 메서드
public Larva()
{
Console.WriteLine("Larva가 생성되었습니다.");
}
//멤버 메서드
public Zergling Transform(string unitName)
{
Console.WriteLine("{0}(으)로 변태 합니다.", unitName);
for (int i = 0; i < 1; i++)
{
return new Zergling();
}
}
}
저글링 클래스
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Zergling
{
//멤버 변수
//생성자 메서드
public Zergling()
{
Console.WriteLine("저글링이 생성되었습니다.");
}
//멤버 메서드
}
두개 이상의 값을 반환하는 방법을 아직 모른다.
'C# > 수업 과제' 카테고리의 다른 글
클래스 및 인스턴스 만들기와 메서드 연습3 (SCV-배럭) (0) | 2021.12.23 |
---|---|
클래스 및 인스턴스 만들기와 메서드 연습2 (하이템플러-아콘) (0) | 2021.12.23 |
반환값이 있는 메서드 작성 (scv 미네랄, 가스 캐기, 좌표) (0) | 2021.12.23 |
삼일째 수업 복습 (0) | 2021.12.23 |
과제2 (0) | 2021.12.23 |