The correct way to approach polymorphism in this case (JAVA)
<p>I have been given a task that can be simplified to this scenario:</p>

<p>Customers need to order boxes and these boxes can come in different sizes, the different sizes can be ordered in certain colours (but not all colours) and have different qualities (but not all qualities).</p>

<p>Now I believe the best way to approach this would be to make the box class the abstract class and have the different boxes extend the box class to prevent repetitive code, but then the issue comes in, how do I check an order a client puts in is valid without storing static variables in the class (this class cannot have this colour etc.)?</p>

<p>My solution is to simply put static variables in each extension of the class and then check each class without initialising a new object but it means having repeating variable declarations in each class.</p>

<p>Any help is appreciated.</p>
