diff --git a/src/encapsulationInheritancePolymorphism/inheritance/ElectricEngine.java b/src/encapsulationInheritancePolymorphism/inheritance/ElectricEngine.java index 9d48a3e..e0852cd 100644 --- a/src/encapsulationInheritancePolymorphism/inheritance/ElectricEngine.java +++ b/src/encapsulationInheritancePolymorphism/inheritance/ElectricEngine.java @@ -2,4 +2,8 @@ package encapsulationInheritancePolymorphism.inheritance; public class ElectricEngine extends Engine { private String batteryType; + + /*private class Engine { + private int power; + }*/ } diff --git a/src/encapsulationInheritancePolymorphism/inheritance/FuelEngine.java b/src/encapsulationInheritancePolymorphism/inheritance/FuelEngine.java new file mode 100644 index 0000000..482b600 --- /dev/null +++ b/src/encapsulationInheritancePolymorphism/inheritance/FuelEngine.java @@ -0,0 +1,5 @@ +package encapsulationInheritancePolymorphism.inheritance; + +public class FuelEngine extends Engine { + private String fuelType; +} diff --git a/src/encapsulationInheritancePolymorphism/inheritance/Main.java b/src/encapsulationInheritancePolymorphism/inheritance/Main.java index e4ed9d0..6e7e717 100644 --- a/src/encapsulationInheritancePolymorphism/inheritance/Main.java +++ b/src/encapsulationInheritancePolymorphism/inheritance/Main.java @@ -2,6 +2,7 @@ package encapsulationInheritancePolymorphism.inheritance; public class Main { public static void main(String[] args) { - ElectricEngine electricEngine = new ElectricEngine(); + ElectricEngine electricEngine = new ElectricEngine(); // створення нового об'єкту (екземпляру) класу ElectricEngine + FuelEngine fuelEngine = new FuelEngine(); } }