<?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: casting in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240505#M1012249</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi  Abhijeet Kulshr...    	 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; thankyou for ur kind information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards.&lt;/P&gt;&lt;P&gt;parthu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Aug 2008 14:41:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-05T14:41:31Z</dc:date>
    <item>
      <title>casting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240500#M1012244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can anyone tell me something about casting in object oriented programing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 12:51:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240500#M1012244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T12:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: casting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240501#M1012245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  Casting in ABAP OBJECTS is concept related to inheritance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Narrow Casting: When you assign reference of subclass to reference of superlass, then by superclass reference, you can access the inhertied components of subclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose you have a class, lcl_vehicle(reference r_vehicle)&lt;/P&gt;&lt;P&gt; and its subclass lcl_car(r_car).&lt;/P&gt;&lt;P&gt;you have a reference variable:&lt;/P&gt;&lt;P&gt;just have a look at example of narrow casting&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: r_vehicle TYPE REF TO lcl_vehicle,
          r_car TYPE REF TO lcl_car.


CREATE OBJECT r_car.

r_vehicle = r_car
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wide Casting: When you assign a superclass reference to subclass reference after narrow casting. Now with this you can access the specific components of subclass.&lt;/P&gt;&lt;P&gt;Have a look at this example&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: r_vehicle TYPE REF TO lcl_vehicle,
          r_car TYPE REF TO lcl_car,
          r_car2 LIKE r_car.

CREATE OBJECT r_car.
r_vehicle = r_car.

r_car2 ?= r_vehicle.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;'?=' This is wide cast operator.&lt;/P&gt;&lt;P&gt;Now with r_car2 reference you can access inherited as well as specific components of subclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Check these links&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5692232"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5692222"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abhijeet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 12:59:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240501#M1012245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T12:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: casting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240502#M1012246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hiii...&lt;/P&gt;&lt;P&gt;there are 2 casting in oops concept.&lt;/P&gt;&lt;P&gt;narrow casting and wide casting..&lt;/P&gt;&lt;P&gt;Imagine, you have a Class B inherting from Class A.&lt;/P&gt;&lt;P&gt;The class B is now more specific than A, because it has the methods of A, and can also do more things because it has its own methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have lv_objb type ref to class_b,&lt;/P&gt;&lt;P&gt;lv_obja type ref to class_a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i create the lv_objb as an object of class b.&lt;/P&gt;&lt;P&gt;But assign this object to lv_obja. This is narrow casting...&lt;/P&gt;&lt;P&gt;which means I have assigne (or cast) a more speicifc object(B) to a generic object (A).&lt;/P&gt;&lt;P&gt;But since you are using a generic object, you have only limited access to the object. You can access only those methos that are defined in A. and hence you have a narrower view of the object B in A. An hence the name narrow cast&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The opposite of this is widening cast.&lt;/P&gt;&lt;P&gt;You have create object B. then you narrow cast by assigning it to a variable of type A.&lt;/P&gt;&lt;P&gt;Now i assign this object A to B1 which is also of type B.&lt;/P&gt;&lt;P&gt;So from having a narrow view using A, you have got to a wier view when you assigned to an object B1. hence the name widening cast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hopefully it will help you a bit...&lt;/P&gt;&lt;P&gt;thanks..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 13:09:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240502#M1012246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T13:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: casting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240503#M1012247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  Please refer to the following links:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3930358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3930358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;/P&gt;&lt;P&gt;Mayukh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 13:12:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240503#M1012247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T13:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: casting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240504#M1012248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Casting, in the simplest definition, is assigning of an object of some specific datatype to a variable of some other (technically different, but compatible) datatype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keeping this picture in mind, you can re-read and explore what others have already provided in this thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-- Zakir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 14:07:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240504#M1012248</guid>
      <dc:creator>former_member509072</dc:creator>
      <dc:date>2008-08-04T14:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: casting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240505#M1012249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi  Abhijeet Kulshr...    	 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; thankyou for ur kind information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards.&lt;/P&gt;&lt;P&gt;parthu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2008 14:41:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240505#M1012249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-05T14:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: casting</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240506#M1012250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank u soo much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards.&lt;/P&gt;&lt;P&gt;bhuma.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2008 15:05:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting/m-p/4240506#M1012250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-05T15:05:52Z</dc:date>
    </item>
  </channel>
</rss>

