Okay so I have an Interface and 2 classes that implement it. The only problem is both classes have methods within them that aren't listed in the interface. I have a test class that uses an ArrayList of the interface type:
ArrayList<Company> employees = new ArrayList<Company>();
The program is designed to allow creation of two seperate classes of employees
public class Salaried implements Company
and
public class Hourly implements Company
and allow certain methods to be used with them. The two classes both implement the interface, but also have additional methods unique to themselves.
In the test class, I'm trying to use the arrayList to store the different employees that are created, so that their methods can be used later. However the program won't compile as I use methods that aren't in the interface when creating the employees and it won't let me use those methods.
How should I go about fixing this? Is it a mistake within the interface or within the classes themselves?
defaultmethod if java 8