|
@@ -286,3 +286,13 @@ class DemoSavingsAccount { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class PolymorphismTest { |
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
Person telemachus = new Person(); |
|
|
|
|
|
telemachus.setName("Τηλέμαχος"); |
|
|
|
|
|
BankAccount b = new SavingsAccount(telemachus, 10); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println(String.format("%s", b)); |
|
|
|
|
|
} |
|
|
|
|
|
} |