diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-05-10 14:31:07 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-05-10 14:31:07 -0600 |
commit | 94254471915826aa8759df483f0b75624d740784 (patch) | |
tree | d146e2505a1911a5363ba14ce51f57d5ee0b7ecb /output/ex24.java | |
parent | 1298a32801f12cc20b5a706377443d557e8da9b6 (diff) |
New tests to verify correct overwriting detection
Diffstat (limited to 'output/ex24.java')
-rw-r--r-- | output/ex24.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/output/ex24.java b/output/ex24.java new file mode 100644 index 0000000..93f6936 --- /dev/null +++ b/output/ex24.java @@ -0,0 +1,21 @@ +class Overriding { + public static void main(String[] args) { + System.out.println(new A().init()); + } +} + +class A { + public int init() { + return 0; + } + + public A x(A a) { + return new B(); + } +} + +class B extends A { + public B x(A a) { + return new B(); + } +} |