title: Java SuperClass and SubClass extending comparable
body: <p>I am doing this assignment where we have to create 2 types of object,</p>
  
  <pre><code>public class Person implements Cloneable, Comparable&lt;Person&gt;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>public class Book implements Cloneable, Comparable&lt;Book&gt;
  </code></pre>
  
  <p>The main task of this program is to sort the two types using its own compare functions as following:</p>
  
  <pre><code>compareTo(Person o)
  compareTo(Book o)
  </code></pre>
  
  <p>So, I created 2 ListArray as following in the main function to store the book and person objects as following:</p>
  
  <pre><code>List&lt;Book&gt; bookArray = new ArrayList&lt;Book&gt;();
  List&lt;Person&gt; peopleArray = new ArrayList&lt;Person&gt;();
  </code></pre>
  
  <p>And I have my sorting algorithm implemented in another class like the following:</p>
  
  <pre><code>public class Sort{
  Comparable&lt;Object&gt;[] values;
  public Sort(List&lt;Object&gt; inputArray) {
    this.values = (Comparable&lt;Object&gt;[]) inputArray.toArray();
  }
  public doSort() {
    //sort implementation...
  }
  </code></pre>
  
  <p>The problem is when calling this function using the arrays above</p>
  
  <pre><code>Sort sorter = new Sort(peopleArray);
  sorter.doSort();
  </code></pre>
  
  <p>Eclipse shows the error saying "The constructor Sort(List) is undefined."
  What am I doing wrong here?
  Thank you in advance.</p>