Last active
November 30, 2021 18:38
-
-
Save tomty89/6cf965ac9737a66f3b947349c63649a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
private int a; | |
// private int b; | |
int b; | |
// private void aa() { | |
// a++; | |
// } | |
void aa() { | |
a++; | |
} | |
} | |
class B extends A { | |
void bb() { | |
b++; | |
} | |
} | |
public class Inherit { | |
public static void main(String[] args) { | |
B b = new B(); | |
b.aa(); | |
A a = b; | |
a.aa(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment