title: Elaborating on Polymorphism
body: <p>I have read many questions on stackoverflow about polymorphism. The question is a question of structuring my ideas because I have read and researched a lot to the point where I have many ideas in mind. I need comments and criticism about my thoughts on polymorphism. I will use Java to demonstrate my ideas.</p>
  
  <p>Polymorphism is a characteristic of having different forms when talking about a certain entity. It could be achieved in the following ways:</p>
  
  <ul>
  <li><p>A derived class inherits from its base class all the visible methods and accordingly could <code>override</code> the behaviour of certain methods.
  e.g:</p>
  
  <pre><code>class Shape {
     void draw(){
           System.out.println("I am drawing using a shape object");
     }
  }
  
  class Rectangle extends Shape{
     void draw(){
       // This method is overriden
       System.out.println("I am drawing using a rectangle object");
     }
  }
  </code></pre></li>
  </ul>
  
  <p>The way polymorphism is achieved here is that if at run-time, <code>draw()</code> was used with an instance of <code>Rectangle</code> the implementation of <code>draw()</code> in the <code>Rectangle</code> class would be invoked. </p>
  
  <p>Since a rectangle is a shape, polymorphism is the fact that <code>draw()</code> took different forms depending on the context where it was being called. This is also known as inheritance polymorphism.</p>
  
  <ul>
  <li><p>Another way to achieve polymorphism is through interfaces.</p>
  
  <pre><code>interface Vehicle{
       void move();
  }
  
  class Car implements Vehicle{
       void move(){
           System.out.println("The car is moving!");
       }
  }
  
  class Plane implements Vehicle{
       void move(){
           System.out.println("The plane is flying!");
       }
  }
  
  // we declare an object of type Vehicle
  // At compile-time, the concrete implementation of someVehicle is no known  
  // and thus polymorphism is achieved in the sense that someVehicle could
  // either be a Car or a Plane depending on which concrete class is used 
  // to instantiate it at run-time.
  
  Vehicle someVehicle;
  </code></pre></li>
  <li><p>User-defined operator overloading(Not in Java, but in C++)</p></li>
  </ul>
  
  <p>In Java, an example of operator overloading would be the + operator where depending on the operands, the + performs a certain functionality. If + is being applied to strings, it concatenates them. If it is being applied to integers, it does arithmetic addition.</p>
  
  <p>Now, is method overloading also a way to achieve polymorphism? What did I miss in my understanding of polymorphism?</p>