<?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 Calling a method from abstarct class in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293712#M1390124</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am working on ABAP Objects. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created an Abstract class - with method m1. &lt;/P&gt;&lt;P&gt;I have implemented m1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As we can not instantiate an abstract class, i tried to call the method m1 directly with class name. &lt;/P&gt;&lt;P&gt;But it it giving error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the code below. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS c1 DEFINITION ABSTRACT. 
  PUBLIC SECTION. 
    DATA: v1 TYPE i. 
    METHODS: m1. 
ENDCLASS.                    "c1 DEFINITION 

CLASS c1 IMPLEMENTATION. 
  METHOD m1. 
    WRITE: 'You called method m1 in class c1'. 
  ENDMETHOD. "m1 
ENDCLASS.                    "c1 IMPLEMENTATION 

CALL METHOD c1=&amp;gt;m1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell me what is wrong and how to solve this problem. &lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Nov 2009 05:36:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-11-12T05:36:20Z</dc:date>
    <item>
      <title>Calling a method from abstarct class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293712#M1390124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am working on ABAP Objects. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created an Abstract class - with method m1. &lt;/P&gt;&lt;P&gt;I have implemented m1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As we can not instantiate an abstract class, i tried to call the method m1 directly with class name. &lt;/P&gt;&lt;P&gt;But it it giving error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the code below. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS c1 DEFINITION ABSTRACT. 
  PUBLIC SECTION. 
    DATA: v1 TYPE i. 
    METHODS: m1. 
ENDCLASS.                    "c1 DEFINITION 

CLASS c1 IMPLEMENTATION. 
  METHOD m1. 
    WRITE: 'You called method m1 in class c1'. 
  ENDMETHOD. "m1 
ENDCLASS.                    "c1 IMPLEMENTATION 

CALL METHOD c1=&amp;gt;m1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell me what is wrong and how to solve this problem. &lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 05:36:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293712#M1390124</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-12T05:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a method from abstarct class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293713#M1390125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well Mytri, actually this is something that can be found in the ABAP (keyword) help. Just enter &lt;STRONG&gt;abstract&lt;/STRONG&gt; in your search (from your program) and you will see the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ABSTRACT addition defines an abstract class class. You cannot create object instances from an abstract class. To use the instance components of an abstract class, a concrete subclass of the class must be instantiated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, you will have to create a second class inheriting from the abstract class, instantiate the second class and call method m1 from abstract class.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 06:10:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293713#M1390125</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-11-12T06:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a method from abstarct class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293714#M1390126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Micky is right, &lt;STRONG&gt;abstract&lt;/STRONG&gt; means not to be instantiated. It is just a "template" which you can use for all subsequent classes. I.e you have general abstract class &lt;EM&gt;vehicle&lt;/EM&gt; . For all vehicles you will have the same attributes like &lt;EM&gt;speed&lt;/EM&gt; , &lt;EM&gt;engine type&lt;/EM&gt; ,  &lt;EM&gt;strearing&lt;/EM&gt; , &lt;EM&gt;gears&lt;/EM&gt; etc and methods like &lt;EM&gt;start&lt;/EM&gt; , &lt;EM&gt;move&lt;/EM&gt; etc. &lt;/P&gt;&lt;P&gt;In all subsequent classes (which inherit from vehicle) you will have more specific attributes for each. But all of these classes have some common things (like the ones mentioned above), so they use abstract class to define these things for all of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moreover there is no sense in creating instance (real object) of class &lt;EM&gt;vehicle&lt;/EM&gt; . What kind of physical object would &lt;EM&gt;vehicle&lt;/EM&gt; be? there is no such object in real world, right? For this we need to be more precise, so we create classes which use this "plan" for real vehicles. So the &lt;EM&gt;abstract&lt;/EM&gt; class here is only to have this common properties and behaviour defined in one place for all objects which will have these. &lt;EM&gt;Abstract&lt;/EM&gt; object however cannot be created per se. You can only create objects which are lower in hierarchy (which are specific like &lt;EM&gt;car&lt;/EM&gt; , &lt;EM&gt;ship&lt;/EM&gt;, &lt;EM&gt;bike&lt;/EM&gt; etc). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this claryfies what we need &lt;EM&gt;abstract&lt;/EM&gt; classes for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 08:29:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293714#M1390126</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-11-12T08:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a method from abstarct class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293715#M1390127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mytri,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In an abstract class there should be a method which is abstract(  ie without having any implementation )&lt;/P&gt;&lt;P&gt;How your class is syntactically corrrect I dont know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These abstract methods needs to be implemented/redefined in the subclasses .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg think of an class animal ( which is an ideal example of Abstract class ) which is having an abstract method eat( )&lt;/P&gt;&lt;P&gt;. You need to have subclasses like Lion Tiger etc where we can clearly redefine/implement this method&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 08:44:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-from-abstarct-class/m-p/6293715#M1390127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-12T08:44:13Z</dc:date>
    </item>
  </channel>
</rss>

