Skip to content

Instantly share code, notes, and snippets.

@fermopili
Created March 19, 2017 13:18
Show Gist options
  • Save fermopili/9074521b691242d9219231b9965365b7 to your computer and use it in GitHub Desktop.
Save fermopili/9074521b691242d9219231b9965365b7 to your computer and use it in GitHub Desktop.
com.javarush.task.task15.task1528
/*
ООП - наследование
*/
public class Solution
{
public static void main(String[] args)
{
System.out.println(new Hrivna().getAmount());
}
public static abstract class Money
{
abstract Money getMoney();
public Object getAmount()
{
return getMoney().getAmount();
}
}
//add your code below - добавь код ниже
public static class Hrivna extends Money
{
public double amount = 123d;
public Hrivna getMoney()
{
return this;
}
public Object getAmount()
{
return amount;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment