<?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: OOPS, Super class - sub classs reference in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925393#M689121</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;Try this way.&lt;/P&gt;&lt;P&gt;CLASS lcl_employee DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The public section is accesible from outside&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;      BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;        no  TYPE i,&lt;/P&gt;&lt;P&gt;        name TYPE string,&lt;/P&gt;&lt;P&gt;     END OF t_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor&lt;/P&gt;&lt;P&gt;        IMPORTING im_employee_no TYPE i&lt;/P&gt;&lt;P&gt;                  im_employee_name TYPE string,&lt;/P&gt;&lt;P&gt;      display_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Class methods are global for all instances&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-METHODS: display_no_of_employees.&lt;/P&gt;&lt;P&gt;  PROTECTED SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The protecetd section is accesible from the class and its subclasses&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Class data are global for all instances&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA: g_no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The private section is only accesible from within the classs&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;DATA: g_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*--- LCL Employee - Implementation&lt;/P&gt;&lt;P&gt;CLASS lcl_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    g_employee-no = im_employee_no.&lt;/P&gt;&lt;P&gt;    g_employee-name = im_employee_name.&lt;/P&gt;&lt;P&gt;    g_no_of_employees = g_no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_employee.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Employee', g_employee-no, g_employee-name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Number of employees is:', g_no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;P&gt;DATA: g_employee1 TYPE REF TO lcl_employee,&lt;/P&gt;&lt;P&gt;      g_employee2 TYPE REF TO lcl_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_employee1&lt;/P&gt;&lt;P&gt;    EXPORTING im_employee_no = 1&lt;/P&gt;&lt;P&gt;              im_employee_name = 'Vikram.C'.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_employee2&lt;/P&gt;&lt;P&gt;    EXPORTING im_employee_no = 2&lt;/P&gt;&lt;P&gt;              im_employee_name = 'Raghava.V'.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee1-&amp;gt;display_employee.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee2-&amp;gt;display_employee.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Oct 2007 07:16:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-09T07:16:55Z</dc:date>
    <item>
      <title>OOPS, Super class - sub classs reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925390#M689118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New to OOPS and stuck now. So need your help.&lt;/P&gt;&lt;P&gt;Have created two classes, one super class and one sub class.&lt;/P&gt;&lt;P&gt;Sub class has one extra method.&lt;/P&gt;&lt;P&gt;Created references for both classes.&lt;/P&gt;&lt;P&gt;Now i tried refsubclass ?= refsuperclass.&lt;/P&gt;&lt;P&gt;Its dumping.&lt;/P&gt;&lt;P&gt;Wat may be the cause.&lt;/P&gt;&lt;P&gt;Help pls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Renjith&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2007 06:52:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925390#M689118</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-09T06:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: OOPS, Super class - sub classs reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925391#M689119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;put this code in &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;catch system-exceptions &lt;/P&gt;&lt;P&gt;endcatch&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2007 07:00:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925391#M689119</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-09T07:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: OOPS, Super class - sub classs reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925392#M689120</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;this "refsubclass ?= refsuperclass" must dumping if the "refsuperclass" point to an instance of the superclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only something like this will work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object refsuperclass type &amp;lt;subclasstype&amp;gt;.&lt;/P&gt;&lt;P&gt;Now the statement work.&lt;/P&gt;&lt;P&gt;refsubclass ?= refsuperclass (this is the widening cast).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This work too:&lt;/P&gt;&lt;P&gt;create object refsubclass type &amp;lt;subclasstype&amp;gt;.&lt;/P&gt;&lt;P&gt;refsuperclass = refsubclass (this is narrowing cast).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this will not work and dump:&lt;/P&gt;&lt;P&gt;create object refsuperclass type &amp;lt;superclasstype&amp;gt;.&lt;/P&gt;&lt;P&gt;refsubclass ?= refsuperclass&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gianpietro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2007 07:07:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925392#M689120</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-09T07:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: OOPS, Super class - sub classs reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925393#M689121</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;Try this way.&lt;/P&gt;&lt;P&gt;CLASS lcl_employee DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The public section is accesible from outside&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;    TYPES:&lt;/P&gt;&lt;P&gt;      BEGIN OF t_employee,&lt;/P&gt;&lt;P&gt;        no  TYPE i,&lt;/P&gt;&lt;P&gt;        name TYPE string,&lt;/P&gt;&lt;P&gt;     END OF t_employee.&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;      constructor&lt;/P&gt;&lt;P&gt;        IMPORTING im_employee_no TYPE i&lt;/P&gt;&lt;P&gt;                  im_employee_name TYPE string,&lt;/P&gt;&lt;P&gt;      display_employee.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Class methods are global for all instances&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-METHODS: display_no_of_employees.&lt;/P&gt;&lt;P&gt;  PROTECTED SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The protecetd section is accesible from the class and its subclasses&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Class data are global for all instances&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CLASS-DATA: g_no_of_employees TYPE i.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The private section is only accesible from within the classs&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;DATA: g_employee TYPE t_employee.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;*--- LCL Employee - Implementation&lt;/P&gt;&lt;P&gt;CLASS lcl_employee IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    g_employee-no = im_employee_no.&lt;/P&gt;&lt;P&gt;    g_employee-name = im_employee_name.&lt;/P&gt;&lt;P&gt;    g_no_of_employees = g_no_of_employees + 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_employee.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Employee', g_employee-no, g_employee-name.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;  METHOD display_no_of_employees.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Number of employees is:', g_no_of_employees.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;R E P O R T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;P&gt;DATA: g_employee1 TYPE REF TO lcl_employee,&lt;/P&gt;&lt;P&gt;      g_employee2 TYPE REF TO lcl_employee.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_employee1&lt;/P&gt;&lt;P&gt;    EXPORTING im_employee_no = 1&lt;/P&gt;&lt;P&gt;              im_employee_name = 'Vikram.C'.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT g_employee2&lt;/P&gt;&lt;P&gt;    EXPORTING im_employee_no = 2&lt;/P&gt;&lt;P&gt;              im_employee_name = 'Raghava.V'.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee1-&amp;gt;display_employee.&lt;/P&gt;&lt;P&gt;  CALL METHOD g_employee2-&amp;gt;display_employee.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2007 07:16:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925393#M689121</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-09T07:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: OOPS, Super class - sub classs reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925394#M689122</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;&amp;lt;b&amp;gt;Synatx and Visisbilty&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)the public and protected components of the super class are visible in the subclass&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)private section of the super class is not visible in the sub classes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)private components of the sub class can have same name as the private component of the super class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) public and protected components of the sub class can not have the same name as that have been used in super class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Synatx&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS SUPER_CLAS DEFINATION &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;PUBLIC COMPONENTS &lt;/P&gt;&lt;P&gt;PROTECTED SECTION &lt;/P&gt;&lt;P&gt;PROTECTED COMPONETS &lt;/P&gt;&lt;P&gt;PRIVATE SECTION &lt;/P&gt;&lt;P&gt;PRIVATE COMPONENTS &lt;/P&gt;&lt;P&gt;ENDCLASS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS SUB_CLASS DEFINATION INHERITING FROM SUPER_CLASS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;PUBLIC COMPONENTS &lt;/P&gt;&lt;P&gt;PUBLIC COMPONENTS (SUPER_CLASS)&lt;/P&gt;&lt;P&gt;PROTECTED SECTION &lt;/P&gt;&lt;P&gt;PROTECTED COMPONETS &lt;/P&gt;&lt;P&gt;PROTECTED COMPONENTS (SUPER CLASS)&lt;/P&gt;&lt;P&gt;PRIVATE SECTION &lt;/P&gt;&lt;P&gt;PRIVATE COMPONENTS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;friend class&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C1 DEFINITION FRIENDS OBJ1 .. OBJN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C1 DEFINITION LOCAL FRIENDS OBJ1..OBJN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C1 DEFINITION GLOBAL FRIENDS OBJ1..OBJN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with the friend relationship one class can grant another class or interface (and all clases that implement that interface ) acess to its PROTECTED AND PRIVATE COMPONENTS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;friendship is one sided class c1 granting feindship to class c2 does not mean c1 is a friend of c2 unless c2 explicitly grants c1 as friend &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;subclasses of friend and interfaces that receives a friend as a component interface &lt;/P&gt;&lt;P&gt;become friend &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a friend of a super class is not automatically friend of itssub class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if useful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2007 10:15:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/oops-super-class-sub-classs-reference/m-p/2925394#M689122</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-12T10:15:32Z</dc:date>
    </item>
  </channel>
</rss>

