add inheritance example

This commit is contained in:
Oleksii Aleshchenko 2023-02-23 16:03:51 +02:00
parent 9112df275b
commit 8b6da131a0
3 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,5 @@
package encapsulationInheritancePolymorphism.inheritance;
public class ElectricEngine extends Engine {
private String batteryType;
}

View File

@ -0,0 +1,5 @@
package encapsulationInheritancePolymorphism.inheritance;
public class Engine {
private int power;
}

View File

@ -0,0 +1,7 @@
package encapsulationInheritancePolymorphism.inheritance;
public class Main {
public static void main(String[] args) {
ElectricEngine electricEngine = new ElectricEngine();
}
}