Skip to content

Instantly share code, notes, and snippets.

@colm-mchugh
Created May 10, 2017 03:57
Show Gist options
  • Save colm-mchugh/0f670d8ff2bd573582f92bbd95eda725 to your computer and use it in GitHub Desktop.
Save colm-mchugh/0f670d8ff2bd573582f92bbd95eda725 to your computer and use it in GitHub Desktop.
plemm questionnaire - java
package plemm;
import org.junit.Test;
public class PlemmTest {
static class A {
int x;
public A() {
x = 3;
}
public int f() {
return x;
}
public int g() {
return x + f();
}
}
static class B extends A {
int x;
public B() {
x = 30;
}
public int f() {
return x;
}
}
static class C extends B {
int x;
public C() {
x = 300;
}
public int g() {
return x + f();
}
}
@Test
public void testABC() {
A ainst = new C();
System.out.println(ainst.x);
System.out.println(ainst.f());
System.out.println(ainst.g());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment