.NET프로그래밍/C# 3.5 SP1
69. 분할클래스(partial class)
holland14
2009. 8. 17. 11:23
==> 분할클래스.cs
// 분할클래스:
// 동일한 클래스를 여러개의 파일에 걸쳐 나눠서 설계
// 실제 빌드(컴파일)했을 때에는 단일 클래스로 합쳐짐...
using System;
public class 분할클래스
{
public static void Main()
{
Car s = new Car("소나타");
s.Run();
}
}
public partial class Car
{
// Constructor
public Car(string name)
{
this.name = name;
}
}
==============================================================================================
==> Car.cs
using System;
public partial class Car
{
// Field
private string name;
}
public partial class Car
{
// Method
public void Run()
{
Console.WriteLine("{0} 달리다", this.name);
}
}