title: Class returning the extended class' parameter instead of it's own parameter when using an extended method
body: <p>Sorry if the title is a little bit confusing! I got this class called Flower that extends a Plant class (for a school assignment) and I have a <code>getType()</code> method in Plant which just returns <code>this.type</code> . My issue is that when I run this method on a Flower object, instead of returning the type of Flower, it just returns <code>null</code> (which is the default return in the Plant class). I was wondering if there is any way to fix this without having to override the method, because that would kind of defeat the whole point of the assignment. The code I have is as below:</p>
  <p>Plant Class:</p>
  <pre><code>public class Plant {
      
      protected List&lt;String&gt; plot = new ArrayList&lt;&gt;();
      private String type;
      
      public Plant() {
          //Some stuff here
  
          this.type = null;
      }
      
      public String getType() {
          return this.type;
      }
      //More stuff for the class here
  </code></pre>
  <p>Flower Class:</p>
  <pre><code>public class Flower extends Plant {
      private String type;
      private int size;
  
      public Flower(String type) {
          this.plot = new ArrayList&lt;&gt;();
          this.type = type;
          this.size = 0;
  
          //More code not important for the question goes here...
  </code></pre>
  <p>Thank you for your help in advance!</p>