11일차 클래스(7)
Console Programming/C# Console 2019. 10. 4. 14:30오픈마켓
---------------------
이름: G마켓
---------------------
상품을 만든다
상품
---------------------
이름: 비타민C스틱
이름: 아기 물티슈
이름: 후드티
요구사항
---------------------
생성자 (매개변수)
|
Product.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;
namespace Syntax34
{
public class Product
{
//data
//name
public string name;
public Product(string name)
{
this.name = name;
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
OpenMarket.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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax34
{
public class OpenMarket
{
//data
//name
public string name;
public OpenMarket(string name)
{
this.name = name;
}
public Product MakeProduct(string name)
{
var product = new Product(name);
return product;
}
}
}
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax34
{
public class App
{
public App()
{
var openMarket1 = new OpenMarket("G마켓");
var product1 = openMarket1.MakeProduct("비타민C스틱");
var product2 = openMarket1.MakeProduct("아기 물티슈");
var product3 = openMarket1.MakeProduct("후드티");
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
'Console Programming > C# Console' 카테고리의 다른 글
11일차 클래스(9) (0) | 2019.10.04 |
---|---|
11일차 클래스(8) (0) | 2019.10.04 |
11일차 클래스(6) (0) | 2019.10.04 |
11일차 클래스(5) (0) | 2019.10.04 |
11일차 클래스(4) (0) | 2019.10.04 |