메인 메서드
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
Carrier carrier1 = new Carrier();
for (int i = 0; i < 5; i++)
{
carrier1.CreateInterceptor();
}
Console.ReadLine();
}
}
캐리어 클래스
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Carrier
{
//멤버 변수
//생성자 메서드
public Carrier()
{
Console.WriteLine("캐리어가 생성되었습니다.");
}
//멤버 메서드
public Interceptor CreateInterceptor()
{
Console.WriteLine("인터셉터를 생성합니다.");
return new Interceptor();
}
}
인터셉터 클래스
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Interceptor
{
//멤버 변수
//생성자 메서드
public Interceptor()
{
Console.WriteLine("인터셉터가 생성되었습니다.");
}
//멤버 메서드
}
'C# > 수업 과제' 카테고리의 다른 글
클래스 생성과 인스턴스 생성 및 메서드 연습 과제 (0) | 2021.12.24 |
---|---|
클래스 및 인스턴스 만들기와 메서드 연습6 (히드라-러커) (0) | 2021.12.23 |
클래스 및 인스턴스 만들기와 메서드 연습4 (벌쳐-마인) (0) | 2021.12.23 |
클래스 및 인스턴스 만들기와 메서드 연습3 (SCV-배럭) (0) | 2021.12.23 |
클래스 및 인스턴스 만들기와 메서드 연습2 (하이템플러-아콘) (0) | 2021.12.23 |