C#/실습
10.02 자동차 부품설정
미고렝
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
|