Last active
March 25, 2018 17:50
Star
You must be signed in to star a gist
golang oop 2 article snippet
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
// the example is in Java | |
class Base { | |
private int i = 0; | |
void inc1() { | |
inc2(); // the change | |
} | |
void inc2() { | |
i++; | |
} | |
} | |
class Child extends Base { | |
@Override | |
void inc2() { | |
inc1(); | |
} | |
} | |
Child child = new Child(); | |
child.inc2(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment