10.02 자동차 부품설정
C#/실습 2019. 10. 2. 17:32코드:
1
2
3
4
5
6
7
8
9
10
11
12
|
class App
{
public App()
{
Car car1 = new Car("KIA 모닝");
Engine engine1 = new Engine("카파 1.0 ECO Prime");
Tire tire1 = new Tire("Kumho 타이어");
car1.GetEngine(engine1);
car1.GetTire(tire1);
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
class Car
{
public string name;
public Car(string name)
{
this.name = name;
Console.WriteLine(this.name + "이(가) 생성되었습니다.");
}
public Engine GetEngine(Engine engine)
{
return engine;
}
public Tire GetTire(Tire tire)
{
return tire;
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
1
2
3
4
5
6
7
8
9
10
|
class Engine
{
public string name;
public Engine(string name)
{
this.name = name;
Console.WriteLine(this.name + "이(가) 생성되었습니다.");
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
1
2
3
4
5
6
7
8
9
10
11
|
class Tire
{
public string name;
public string standard = "Solus TA31";
public Tire(string name)
{
this.name = name;
Console.WriteLine(this.name + "이(가) 생성되었습니다.");
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
'C# > 실습' 카테고리의 다른 글
10.07 class 활용해 자동차만들기 (0) | 2019.10.07 |
---|---|
10.02 컴퓨터 조립 (0) | 2019.10.02 |
10.02 버거세트 (0) | 2019.10.02 |
10.02 커피상점 (0) | 2019.10.02 |
10.01 커맨드센터에서 SCV1,2를 만들고 공격하기 (0) | 2019.10.01 |