11일차 클래스(11)

Console Programming/C# Console 2019. 10. 4. 14:40

의류 상점

 

 
Cloth.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 Syntax38
{
    public class Cloth
    {
        //data
        //name
        public string name;
 
        public Cloth()
        {
 
        }
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

 

 
ClothingShop.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Syntax38
{
    public class ClothingShop
    {
 
        //data
        //name
        public string name;
 
        public ClothingShop()
        {
 
        }
 
        //function
        public Cloth MakeCloth(string name)
        {
            var cloth = new Cloth();
            cloth.name = name;
            return cloth;
        }
    }
}
 
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
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Syntax38
{
    public class App
    {
        
        public App()
        {
            var clothingShop1 = new ClothingShop();
            clothingShop1.name = "ZARA";
 
            Console.WriteLine($"{clothingShop1.name}이(가) 만들어졌습니다.");
 
            var cloth1 = clothingShop1.MakeCloth("아우터");
            var cloth2 = clothingShop1.MakeCloth("자켓");
            var cloth3 = clothingShop1.MakeCloth("원피스");
 
            Console.WriteLine($"{cloth1.name}이(가) 만들어졌습니다.");
            Console.WriteLine($"{cloth2.name}이(가) 만들어졌습니다.");
            Console.WriteLine($"{cloth3.name}이(가) 만들어졌습니다.");
 
 
        }
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

'Console Programming > C# Console' 카테고리의 다른 글

11일차 클래스(13)  (0) 2019.10.04
11일차 클래스(12)  (0) 2019.10.04
11일차 클래스(10)  (0) 2019.10.04
11일차 클래스(9)  (0) 2019.10.04
11일차 클래스(8)  (0) 2019.10.04
: