Tent Class
Overriding Methods
This class shows you how to override methods from a parent class.
Your tent will have 1 room, 2 walls, and will NOT have a washer.
Since a tent doesn't really have much value, it does not make sense to use
the propertyValue()
method defined in Residence. Instead, you
can override propertyValue()
by using the same method stub
present in Residence, but changing the logic inside the method. So, you will
make a method in Tent called propertyValue()
that returns a
double, but all it does inside the method is return 0. Method overriding looks like this:
public double propertyValue() { return 0; }
Also, a tent has no windows, so you should also override the
numWindows()
method to return 0.
When you override a method, Eclipse will show, to the left of your method, a little green triangle that points upward.