10일차 클래스(2) 버거상점, 세트메뉴
Console Programming/C# Console 2019. 10. 4. 14:10버거상점
------------------
이름:맥도날드
------------------
버거를만든다
음료를만든다
감자칩을만든다
버거세트를만든다
버거
------------------
이름:1955버거
------------------
음료
------------------
이름:콜라
------------------
감자칩
------------------
이름:감자칩
------------------
버거세트
------------------
이름:1955세트
------------------
버거를만든다
음료를만든다
감자칩을만든다
|
Burger.cs
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Syntax27
{
public class Burger
{
//데이터
//이름
public string name;
public Burger()
{
}
//기능
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
Drink.cs
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Syntax27
{
public class Drink
{
//데이터
//이름
//크기
public string name;
public Drink()
{
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
FrenchFries.cs
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Syntax27
{
public class FrenchFries
{
//데이터
//이름
//크기
public string name;
public FrenchFries()
{
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
ValueMeals.cs
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System;
using System.Collections.Generic;
namespace Syntax27
{
public class ValueMeals
{
//데이터
//이름
public string name;
public Burger burger;
public Drink drink;
public FrenchFries frenchfries;
public ValueMeals()
{
burger = new Burger();
drink = new Drink();
frenchfries = new FrenchFries();
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
버거세트를 호출하면 새로운 버거, 음료, 감자칩이 만들어지도록 했다.
버거세트에는 Burger, Drink, FrenchFries 타입의 변수가 각각 데이터로 들어가있다.
|
App.cs
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax27
{
public class App
{
public BurgerShop burgershop1;
public App()
{
BurgerShop burgershop1 = new BurgerShop();
ValueMeals valuemeal1 = burgershop1.MakeValueMeal();
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
'Console Programming > C# Console' 카테고리의 다른 글
11일차 클래스(2) (0) | 2019.10.04 |
---|---|
11일차 클래스 피자상점 (0) | 2019.10.04 |
10일차 클래스 커맨트센터, 유닛(공격,피격) (0) | 2019.10.04 |
9일차 메서드의 정의(16) 인벤토리, 아이템줍기 (0) | 2019.10.03 |
9일차 메서드의 정의(15) 캐릭터 선택, 몬스터 공격 (0) | 2019.10.03 |