<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Polymorphism in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912274#M379662</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi john&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an example for inheritance &amp;amp; polymorphism &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public class Hourly extends Employee  { &lt;/P&gt;&lt;P&gt;   public Hourly(String name, double rate, double hours)  { &lt;/P&gt;&lt;P&gt;      super(name); &lt;/P&gt;&lt;P&gt;      setRate(rate); &lt;/P&gt;&lt;P&gt;      setHours(hours); &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   public void setRate(double rate)  { &lt;/P&gt;&lt;P&gt;      this.rate = rate; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;   public void setHours(double hours)  { &lt;/P&gt;&lt;P&gt;      this.hours = hours; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   public double getRate()  { &lt;/P&gt;&lt;P&gt;      return rate; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;   public double getHours()  { &lt;/P&gt;&lt;P&gt;      return hours; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   public double pay()  { &lt;/P&gt;&lt;P&gt;      return rate * hours; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   public String toString()  { &lt;/P&gt;&lt;P&gt;      return super.toString() + " (rate is " + rate + " and hours are " + hours + ')'; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   private double rate; &lt;/P&gt;&lt;P&gt;   private double hours; &lt;/P&gt;&lt;P&gt;} &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;with regards&lt;/P&gt;&lt;P&gt;vinayaka&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Feb 2007 16:09:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-14T16:09:11Z</dc:date>
    <item>
      <title>Polymorphism</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912271#M379659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;  can anyone give me a example of polymorphism using which "CASE" and "IF"&lt;/P&gt;&lt;P&gt;statements can be avoided.&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 09:04:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912271#M379659</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T09:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Polymorphism</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912272#M379660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     Check this examples demo_interface ,demo_inheritance in SE38.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 10:46:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912272#M379660</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T10:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Polymorphism</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912273#M379661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lets say you want to calculate the needed fuel for a trip and you have got different vehicles  like car, airplane and bus. All of them need a different calculation.&lt;/P&gt;&lt;P&gt;You do this with case or if statement like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case vehicle.&lt;/P&gt;&lt;P&gt;when bus.&lt;/P&gt;&lt;P&gt;bus fuel calculation.&lt;/P&gt;&lt;P&gt;when airplane.&lt;/P&gt;&lt;P&gt;airplane fuel calculation.&lt;/P&gt;&lt;P&gt;when car.&lt;/P&gt;&lt;P&gt;car fuel calculation.&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use Polymorphism, you will have a abstract class vehicle and three classes car, bus and airplane which inherit an abstract method calcFuel(). The abstract class vehicle can not be instantiated, so at the runtime it has do be an object of the inheriting types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to implement the method calcFuel() in the classes car etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to ask a vehicle at the runtime for the needed fuel you will do it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vehicle-&amp;gt;calcFuel().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the vehicle can be an object of the type car, bus and airplane and you don't need a case or if statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan Huemer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 11:00:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912273#M379661</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T11:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Polymorphism</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912274#M379662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi john&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an example for inheritance &amp;amp; polymorphism &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public class Hourly extends Employee  { &lt;/P&gt;&lt;P&gt;   public Hourly(String name, double rate, double hours)  { &lt;/P&gt;&lt;P&gt;      super(name); &lt;/P&gt;&lt;P&gt;      setRate(rate); &lt;/P&gt;&lt;P&gt;      setHours(hours); &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   public void setRate(double rate)  { &lt;/P&gt;&lt;P&gt;      this.rate = rate; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;   public void setHours(double hours)  { &lt;/P&gt;&lt;P&gt;      this.hours = hours; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   public double getRate()  { &lt;/P&gt;&lt;P&gt;      return rate; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;   public double getHours()  { &lt;/P&gt;&lt;P&gt;      return hours; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   public double pay()  { &lt;/P&gt;&lt;P&gt;      return rate * hours; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   public String toString()  { &lt;/P&gt;&lt;P&gt;      return super.toString() + " (rate is " + rate + " and hours are " + hours + ')'; &lt;/P&gt;&lt;P&gt;   } &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   private double rate; &lt;/P&gt;&lt;P&gt;   private double hours; &lt;/P&gt;&lt;P&gt;} &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;with regards&lt;/P&gt;&lt;P&gt;vinayaka&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2007 16:09:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/polymorphism/m-p/1912274#M379662</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-14T16:09:11Z</dc:date>
    </item>
  </channel>
</rss>

