Last active
March 25, 2018 17:50
-
-
Save girish3/4aa61991505f9e8f7688fb6f6870f232 to your computer and use it in GitHub Desktop.
golang oop 2 article snippet
This file contains hidden or 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