Open siddltkfkd opened 3 months ago
class A {
void m() {
System.out.println("a");
}
}
class B extends A {
void m() {
System.out.println("b");
}
}
class C extedns B {
void m() {
System.out.println("c");
}
}
class D extends C {
void m() {
System.out.println("d");
}
}
class Test {
main() {
D d = new D();
C c = d;
B b = c;
A a = a;
System.out.println(a.m());
System.out.println(b.m());
System.out.println(c.m());
System.out.println(d.m());
}
}
class A {
virtual void m() {
System.out.println("a");
}
}
class B : A {
override void m() {
System.out.println("b");
}
}
class C : B {
new virtual void m() {
System.out.println("c");
}
}
class D : C {
override void m() {
System.out.println("d");
}
}
class Test {
main() {
D d = new D();
C c = d;
B b = c;
A a = a;
System.out.println(a.m());
System.out.println(b.m());
System.out.println(c.m());
System.out.println(d.m());
}
}
interface
sub class
interface의 default 메소드와 static 메소드 default 메소드
C#의 상속