add inheritance example
This commit is contained in:
parent
53a9d20438
commit
2880b770f7
|
@ -0,0 +1,5 @@
|
|||
package encapsulationInheritancePolymorphism.inheritance;
|
||||
|
||||
public class ElectricEngine extends Engine {
|
||||
private String batteryType;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package encapsulationInheritancePolymorphism.inheritance;
|
||||
|
||||
public class Engine {
|
||||
private int power;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package encapsulationInheritancePolymorphism.inheritance;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
ElectricEngine electricEngine = new ElectricEngine();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue