|
Is each of the classes Toy and Book Taxable? A good answer might be:Yes. | |
Interface as a TypeAn interface can be used as a data type for a reference variable. Since Toy and Book implement Taxable, they can both be used with a reference variable of type Taxable:
The compiler has been told in the interface that all Taxable objects will have a calculateTax() method, so that method can be used with the variables. | |
QUESTION 15:Would the following work? Click Here after you have answered the questionitem1.display() ; |