11일차 클래스(10)
Console Programming/C# Console 2019. 10. 4. 14:38신발상점
--------------------
이름: 나이티
--------------------
신발을 만든다
신발
--------------------
이름: 에어멕스
이름: 모나크
이름: 에어포스
요구사항
--------------------
생성자 (매개변수)
|
Shoe.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;
namespace Syntax37
{
public class Shoes
{
//data
//name
public string name;
public Shoes(string name)
{
this.name = name;
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
ShoesShop.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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax37
{
public class ShoesShop
{
//data
//name
public string name;
public ShoesShop(string name)
{
this.name = name;
}
//fuction
public Shoes MakeShoes(string name)
{
var shoes = new Shoes(name);
return shoes;
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
App.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;
namespace Syntax37
{
public class App
{
public App()
{
var shoesShop1 = new ShoesShop("나이키");
var shoes1 = shoesShop1.MakeShoes("에어멕스");
var shoes2 = shoesShop1.MakeShoes("모나크");
var shoes3 = shoesShop1.MakeShoes("에어포스");
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
'Console Programming > C# Console' 카테고리의 다른 글
11일차 클래스(12) (0) | 2019.10.04 |
---|---|
11일차 클래스(11) (0) | 2019.10.04 |
11일차 클래스(9) (0) | 2019.10.04 |
11일차 클래스(8) (0) | 2019.10.04 |
11일차 클래스(7) (0) | 2019.10.04 |