Created
November 24, 2018 07:35
-
-
Save skrekhere/6e95a910efada3ef538765a14907d0a1 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
//initializing parent class | |
class A{ | |
int x;//variable as example | |
A(int _x){//constructor | |
x = _x;//init | |
} | |
} | |
//extending class | |
class Derived extends A{ | |
int y;//variable as example | |
Derived(int _x, int _y){//constructor | |
super(_x);//super calls the parent constructor to avoid any errors | |
y = _y;//init | |
} | |
} | |
void main(){ | |
Derived d = new Derived(0,0);//variable things | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment