한 줄 요약
다이아몬드 문제 : 다중 상속을 허용할 경우 두 개의 상위 클래스에서 구현된 것 중 어떤 건을 자식에서 채택해야할 지 불분명해지는 문제가 발생
(인터페이스는 구현을 포함하지 않으므로 다중 상속 가능)
abstract class GrandParent{ public abstract void TestMethod(); }
class Parent1 : GrandParent {public void TestMethod() {};}
class parent2 : GrandParent {public void TestMethod() {};}
class Child : Parent1, Parent2
{
void Initialize()
{
TestMethod() //Parent1, Parent2 중에서 어떤 메서드를 실행할지 불분명
}
}
interface IGrandParent{ public void TestMethod(); }
interface IParent1 : IGrandParent {public void TestMethod();}
interface Iparent2 : IGrandParent {public void TestMethod();}
class Child : IParent1, IParent2
{
void Initialize()
{
TestMethod()
}
}