[C# 4.0]파생클래스 P.225 문의드립니다
2016-01-12
|
by secondtonone
1850
class Base //2번
{
portected string Name;
public Base(string Name)
{
this.Name=Name;
}
}
class Derived : Base //1번
{
public Derived(string Name) : base(Name) //3번
{
Console.WriteLine("{0}.Derived()", this.Name);
}
}
메인클래스에서 Derived b= new Derived("b");
b 객체 생성후 "b" 매개변수를 가지고 윗 부분 1번이라고 적은곳에서 (class Derived : Base //1번 )
" :Base" 여기서 2번 Base클래스로 가는것인가요?
아니면 3번이라고 적은 부분
class Derived : Base //1번
{
public Derived(string Name) : base(Name) //3번 여기까지와서 base(Name) ="b"라는 매개변수를 가지고
Base클래스로 가는것인지 알고 싶습니다
다소 질문이 서투른점 이해해 주세요