11일차 클래스(22)
Console Programming/C# Console 2019. 10. 4. 15:02
|
CPU.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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax49
{
public class CPU
{
//data
//name
//manufacturer
public string name;
public string manufacturer="AMD";
public CPU(string name,PC pcname)
{
this.name = name;
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
GraphicCard.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 Syntax49
{
public class GraphicCard
{
//data
//name
//manufacturer
public string name;
public string manufacturer="GAINWARD";
public GraphicCard(string name, PC pcname)
{
this.name = name;
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
|
PC.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
37
38
39
40
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax49
{
public class PC
{
//data
//name
//GraphicCard
//CPU
public string name;
public GraphicCard graphicCard;
public CPU cpu;
public PC(string name)
{
this.name = name;
}
//function
//GetGraphicCard
//GetCPU
public void GetGraphicCard(string name)
{
var graphicCard = new GraphicCard(name, this);
this.graphicCard = graphicCard;
}
public void GetCPU(string name)
{
var cpu = new CPU(name, this);
this.cpu = cpu;
}
}
}
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 Syntax49
{
public class App
{
public App()
{
var pc1 = new PC("PC");
pc1.GetGraphicCard("GT730");
pc1.GetCPU("라이젠 3");
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
![](https://blog.kakaocdn.net/dn/covuuZ/btqyM1M3T7b/LADAKe352zJUOtgfvKKs91/img.png)
'Console Programming > C# Console' 카테고리의 다른 글
10.03 11일차 클래스 (29) 질럿,드라군 공격사거리 (0) | 2019.10.08 |
---|---|
11일차 클래스(23) (0) | 2019.10.04 |
11일차 클래스(21) (0) | 2019.10.04 |
11일차 클래스(20) (0) | 2019.10.04 |
11일차 클래스(19) (0) | 2019.10.04 |