<?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: Is A SubClass Self-Aware ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183921#M1373645</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the RTTS to get the class name and get to know which subclass it is.&lt;/P&gt;&lt;P&gt;Method get_class_name of class CL_ABAP_CLASSDESCR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, You can create an additional column in internal table which carries the name of the object as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Sep 2009 20:50:21 GMT</pubDate>
    <dc:creator>naimesh_patel</dc:creator>
    <dc:date>2009-09-24T20:50:21Z</dc:date>
    <item>
      <title>Is A SubClass Self-Aware ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183920#M1373644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let's say we have a superclass, zcl_animal.  It has subclasses zcl_cat and zcl_dog with methods meow() and bark() respectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say we set up an internal table called it_animals of type ref to zcl_animal.&lt;/P&gt;&lt;P&gt;I create a number of cats and dogs and append their refs into it_animals.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Furthermore, &lt;/P&gt;&lt;P&gt;lo_animal is type ref to zcl_animal&lt;/P&gt;&lt;P&gt;lo_cat  is type ref to zcl_cat&lt;/P&gt;&lt;P&gt;lo_dog is type ref to zcl_dog &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I loop through animal into the generic  lo_animal object &lt;/P&gt;&lt;P&gt;Is there anyway for lo_animal to tell what subclass (cat or dog) it is so I can cast it appropriately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(without trial and error casting )?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2009 20:45:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183920#M1373644</guid>
      <dc:creator>mike_mcinerney</dc:creator>
      <dc:date>2009-09-24T20:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is A SubClass Self-Aware ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183921#M1373645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the RTTS to get the class name and get to know which subclass it is.&lt;/P&gt;&lt;P&gt;Method get_class_name of class CL_ABAP_CLASSDESCR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, You can create an additional column in internal table which carries the name of the object as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2009 20:50:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183921#M1373645</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-09-24T20:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Is A SubClass Self-Aware ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183922#M1373646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more thought. (I haven't tested it)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a protected method say ACTION( ) in your class ZCL_ANIMAL. Redefine this method in all subclasses. In the redefinition of method ACTION( ) in subclass ZCL_CAT, call method ME-&amp;gt;MEOW( ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way, your application would not know, which sub-object it is dealing with. It would call the ACTION method and action would decide what to call from Sub-class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2009 20:56:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183922#M1373646</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-09-24T20:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is A SubClass Self-Aware ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183923#M1373647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks  - your first response was what I was looking for.  &lt;/P&gt;&lt;P&gt;Redefinition (which I have a handle on) does not work in my&lt;/P&gt;&lt;P&gt;general case of the underlying problem, as some of the animals,&lt;/P&gt;&lt;P&gt;using this example, are giraffes and do not make a sound&lt;/P&gt;&lt;P&gt;(ie many of our methods won't be applicable across all subclasses)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2009 21:03:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183923#M1373647</guid>
      <dc:creator>mike_mcinerney</dc:creator>
      <dc:date>2009-09-24T21:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is A SubClass Self-Aware ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183924#M1373648</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;your reference to Giraffe made me think you might need delegation instead of inheritance. &lt;/P&gt;&lt;P&gt;(i.e.  STRATEGY PATTERN e.g. at &lt;A href="http://sourcemaking.com/design_patterns/strategy)" target="test_blank"&gt;http://sourcemaking.com/design_patterns/strategy)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Jacques Nomssi Nzali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Sep 2009 22:25:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-a-subclass-self-aware/m-p/6183924#M1373648</guid>
      <dc:creator>nomssi</dc:creator>
      <dc:date>2009-09-26T22:25:17Z</dc:date>
    </item>
  </channel>
</rss>

