Skip to content

Commit

Permalink
[Week3][Chap11] 인터페이스 다중구현 - Diamond 문제 (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
toychip committed Feb 13, 2024
1 parent 6a81e7c commit e559f4f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
18 changes: 18 additions & 0 deletions 임준형/java-basic/src/main/java/week3/poly/diamond/Child.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package week3.poly.diamond;

public class Child implements InterfaceA, InterfaceB{
@Override
public void methodA() {
System.out.println("Child.methodA");
}

@Override
public void methodB() {
System.out.println("Child.methodB");
}

@Override
public void methodCommon() {
System.out.println("Child.methodCommon");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package week3.poly.diamond;

public class DiamondMain {
public static void main(String[] args) {
InterfaceA a = new Child();
a.methodA();
a.methodCommon();

InterfaceB b = new Child();
b.methodB();
b.methodCommon();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package week3.poly.diamond;

public interface InterfaceA {
void methodA();
void methodCommon();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package week3.poly.diamond;

public interface InterfaceB {
void methodB();
void methodCommon();
}

0 comments on commit e559f4f

Please sign in to comment.