From 8b6da131a0a0458486fb6dba8448d2ac860ff0c8 Mon Sep 17 00:00:00 2001 From: Oleksii Aleshchenko Date: Thu, 23 Feb 2023 16:03:51 +0200 Subject: [PATCH] add inheritance example --- .../inheritance/ElectricEngine.java | 5 +++++ .../inheritance/Engine.java | 5 +++++ .../inheritance/Main.java | 7 +++++++ 3 files changed, 17 insertions(+) create mode 100644 src/encapsulationInheritancePolymorphism/inheritance/ElectricEngine.java create mode 100644 src/encapsulationInheritancePolymorphism/inheritance/Engine.java create mode 100644 src/encapsulationInheritancePolymorphism/inheritance/Main.java diff --git a/src/encapsulationInheritancePolymorphism/inheritance/ElectricEngine.java b/src/encapsulationInheritancePolymorphism/inheritance/ElectricEngine.java new file mode 100644 index 0000000..9d48a3e --- /dev/null +++ b/src/encapsulationInheritancePolymorphism/inheritance/ElectricEngine.java @@ -0,0 +1,5 @@ +package encapsulationInheritancePolymorphism.inheritance; + +public class ElectricEngine extends Engine { + private String batteryType; +} diff --git a/src/encapsulationInheritancePolymorphism/inheritance/Engine.java b/src/encapsulationInheritancePolymorphism/inheritance/Engine.java new file mode 100644 index 0000000..2e315da --- /dev/null +++ b/src/encapsulationInheritancePolymorphism/inheritance/Engine.java @@ -0,0 +1,5 @@ +package encapsulationInheritancePolymorphism.inheritance; + +public class Engine { + private int power; +} diff --git a/src/encapsulationInheritancePolymorphism/inheritance/Main.java b/src/encapsulationInheritancePolymorphism/inheritance/Main.java new file mode 100644 index 0000000..e4ed9d0 --- /dev/null +++ b/src/encapsulationInheritancePolymorphism/inheritance/Main.java @@ -0,0 +1,7 @@ +package encapsulationInheritancePolymorphism.inheritance; + +public class Main { + public static void main(String[] args) { + ElectricEngine electricEngine = new ElectricEngine(); + } +}