Binding of super class property

can we bind super class property, for example:
class A
private String message;
pubic String getMessage()
return "My Message";
public void setMessage( String message )
this.message = message;
class B extends A
}now my managed bean returns me a collection of class B objects, and i want to bind in JSF page poperty of its super class like that:
<h:outputText value="#{b.message}" />
It gives me a error "PropertyNotFoundException: b.message.
Is it possible in JSF ??
regards,
Y_NOT_

I threw a quick test up on my JSF app and it works fine for me. It is not because of polymorphism. It must be in the way you are accessing the method. A typo or something small. Or perhaps it's because you are using a collection (and not accessing the Collection properly)?
CowKing

Similar Messages

  • Calling constructor of super class

    Hello everyone! I'm a student. I hope I can find guidance. Here's the issue:
    Super class: Property
    Sub class: House
    constructor of parent class:
    protected Property(String id, char status, String address,
            String tenet, String landlord, long rent, char freq,
            long amtDue, String date, boolean repair, char tradesman)
            this.id = id;
            this.status = status;
            this.address = address;
            this.tenet = tenet;
            this.landlord = landlord;
            this.rent = rent;
            this.freq = freq;
            this.amtDue = amtDue;
            this.repair = repair;
            this.tradesman = tradesman;
            SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yy");
            this.dateDue = formatter.parse(date, new ParsePosition(0));
        }the constuctor of the sub class:
    public House(String id, char status, String address,
            String tenet, String landlord, long rent, char freq,
            long amtDue, String dateDue, boolean repair, char tradesman,
            int broom, int proom, int throom, boolean garden,
            boolean garage, boolean heating)
        super(id, status, address, tenet, landlord, rent, freq,
            amtDue, dateDue, repair, tradesman);
        this.broom = broom;
        this.proom = proom;
        this.throom = throom;
        this.garden = garden;
        this.garage = garage;
        this.heating = heating;
        }I'm sure you notice I'm calling the constructor of the Property in House. That;s where the error is when i try to compile either class. This is the error it shows within the House class.
    Object() in java.lang.Object cannot be applied to (java.lang.String,char,java.lang.String,java.lang.String,java.lang.String,long,char,long,java.lang.String,boolean,char)
    Maybe its elementary? Thanks in advance..

    You haven't pasted all the code so I can only guess that the class House does not extend Property class.
    public class House extends Property
      // put the constructor here
    }If the House class does not extend Property (or any other class) it just extends (by default) the Object class, which does not have the constructor of Property class.
    Hope it helps
    Nick

  • Calling a particular Method of all subclass from a super class

    hi
    I have a class 'A' which is a super class for 'B' ,'C' , 'D'
    my main method is in the class Main and while on the run i am calling methods of B,C,D form this main class.
    but as the first step of execution i need to call a init method which has been defined in all the sub-classes. and there can be any no of sub-classes and all will have the init method and i have to call the init method for all classes. is this possible to do that in runtime. ie i wil not be knowing the names of sub-classes.
    thanks
    zeta

    Sorry if i had mislead you all.
    I am not instantiating from my super class.
    as mjparme i wanted one controller class to do the
    init method calls
    so i got it working from the link you gave.
    URL url = Launcher.class.getResource(name);
    File directory = new File(url.getFile());
    This way i can get all the classes in that
    in that package
    and from reflection i can get whether it is
    her it is a sub class of the particular super class
    and i can call the init methods by making the init
    methods static
    thanks for the help
    zetaThis is a rather fragile solution.
    If the problem is one of knowing which subclasses exist, I would suggest specifying them explicitly via configuration (system property or properties file or whatever).
    One thing that's not entirely clear to me: Is the init going to be called once for each subclass, or once for each instance of each subclass? It sounds to me like it's once per class, but I want to make sure.

  • How to  get the profile object in simple java class  (Property accessor)

    Hi All,
    Please guide me how to get the profile object in simple java class (Property accessor) which is extending the RepositoryPropertyDescriptor.
    I have one requirement where i need the profile object i.e i have store id which is tied to profile .so i need the profile object in the property accessor of the SKU item descriptor property, which is extending RepositoryPropertyDescriptor.
    a.I dont have request object also to do request.resolvename.
    b.It is not a component to create setter and getter.It is simple java class which is extending the RepositoryPropertyDescriptor.
    Advance Thanks.

    Iam afraid you might run into synchronization issues with it. You are trying to get/set value of property of a sku repository item that is shared across various profiles.
    Say one profile A called setPropertyValue("propertyName", value).Now another profile B accesses
    getPropertyValue() {
    super.getPropertyValue() // Chance of getting value set by Profile A.
    // Perform logic
    There is a chance that profile B getting the value set by Profile A and hence inconsistency.
    How about doing this way??
    Create PropertyDescriptor in Profile (i.e user item descriptor), pass the attribute CustomCatalogTools in userProfile.xml to that property.
    <attribute name="catalogTools" value="atg.commerce.catalog.CustomCatalogTools"/>
    getPropertyValue()
    //You have Profile item descriptor and also storeId property value.
    // Use CustomCatalogTools.findSku();
    // Use storeId, profile repository item, sku repository item to perform the logic
    Here user itemdescriptor getPropertyValue/setPropertyValue is always called by same profile and there is consistency.
    -karthik

  • Nor any of its super class is known to this context ...problem

    hi all
    i have simple complex object in jave that looks like this :
    @XmlAccessorType(XmlAccessType.FIELD)
    public class MyID{
        @XmlAttribute
        public short dbnum = (short)0;
        @XmlAttribute
        public short usernum= (short)0;
        @XmlAttribute
        public long userid = (long)0;
        public MyId(){
    }i converted it with jaxb and it generete me corespanding java object with the propreate geters and seters
    now when i try to in the server side to insert this object into List<Object> im geting error saing :
    Caused by: javax.xml.bind.JAXBException: com.WebServices.datastructures.MyID nor any of its super class is known to this context
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:474)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:557)
    ... 47 more
    i must say that if i send back only this object (MyID) the unmarsheling passed successfully
    thanks for your help

    Ok I found it out
    jboss was using the jre default axis impelmentation while the server where my client was deployed was using the axis 2 implementation
    I changed the server to use jre default axis and things worked now
    Thanks
    Sapan

  • Regarding Super classes

    Hi,
    I have created one class in SE24. This class will be used as a super class for other classes.
    When subclasses are derived from this superclass, i want to make sure that some of the methods of superclasses are redefined by the subclasse compulsarily.
    So i want to force the subclasses to redefine complusarily some of the methods of its super class.
    Is this feasible. If so please let me know the corresponding approach.
    Thanks in advance !
    Pramod

    Hi,
    Check this out this will help you.
    Inheritance is the concept of passing the behavior of a class to another class.
    1.You can use an existing class to derive a new class.
    2.Derived class inherits the data and methods of a super class.
    3.However they can overwrite the methods existing methods and also add new once.
    4.Inheritance is to inherit the attributes and methods from a parent class.
    Inheritance:
    Inheritance is the process by which object of one class acquire the properties of another class.
    Advantage of this property is reusability.
    This means we can add additional features to an existing class with out modifying it.
    Go to SE38.
    Provide the program name.
    Provide the properties.
    Save it.
    Provide the logic for inheritance.
    *& Report  ZLOCALCLASS_VARIABLES                      *
    *&----------------------------------------------------*REPORT  ZLOCALCLASS_VARIABLES.
    *OOPS INHERITANCE
    *SUPER CLASS FUNCTIONALITY
    *DEFINE THE CLASS.
    CLASS CL_LC DEFINITION.
    PUBLIC SECTION.
    DATA: A TYPE I,
          B TYPE I,
          C TYPE I.
    METHODS: DISPLAY,
             MM1.
    CLASS-METHODS: MM2.
    ENDCLASS.
    *CLASS IMPLEMENTATION
    CLASS CL_LC IMPLEMENTATION.
    METHOD DISPLAY.
    WRITE:/ 'THIS IS SUPER CLASS' COLOR 7.
    ENDMETHOD.
    METHOD MM1.
    WRITE:/ 'THIS IS MM1 METHOD IN SUPER CLASS'.
    ENDMETHOD.
    METHOD MM2.
    WRITE:/ 'THIS IS THE STATIC METHOD' COLOR 2.
    WRITE:/ 'THIS IS MM2 METHOD IN SUPER CLASS' COLOR 2.
    ENDMETHOD.
    ENDCLASS.
    *SUB CLASS FUNCTIONALITY
    *CREATE THE CLASS.
    *INHERITING THE SUPER CLASS.
    CLASS CL_SUB DEFINITION INHERITING FROM CL_LC. "HOW WE CAN INHERIT
    PUBLIC SECTION.
    DATA: A1 TYPE I,
          B1 TYPE I,
          C1 TYPE I.
    METHODS: DISPLAY REDEFINITION,     "REDEFINE THE SUPER CLASS METHOD
             SUB.
    ENDCLASS.
    *CLASS IMPLEMENTATION.
    CLASS CL_SUB IMPLEMENTATION.
    METHOD DISPLAY.
    WRITE:/ 'THIS IS THE SUB CLASS OVERWRITE METHOD' COLOR 3.
    ENDMETHOD.
    METHOD SUB.
    WRITE:/ 'THIS IS THE SUB CLASS METHOD' COLOR 3.
    ENDMETHOD.
    ENDCLASS.
    *CREATE THE OBJECT FOR SUB CLASS.
    DATA: OBJ TYPE REF TO CL_SUB.
    START-OF-SELECTION.
    CREATE OBJECT OBJ.
    CALL METHOD OBJ->DISPLAY. "THIS IS SUB CLASS METHOD
    CALL METHOD OBJ->SUB.
    WRITE:/'THIS IS THE SUPER CLASS METHODS CALLED BY THE SUB CLASS OBJECT'COLOR 5.
    SKIP 1.
    CALL METHOD OBJ->MM1.     "THIS IS SUPER CLASS METHOD
    CALL METHOD OBJ->MM2.
    *CREATE THE OBJECT FOR SUPER CLASS.
    DATA: OBJ1 TYPE REF TO CL_LC.
    START-OF-SELECTION.
    CREATE OBJECT OBJ1.
    SKIP 3.
    WRITE:/ 'WE CAN CALL ONLY SUPER CLASS METHODS BY USING SUPER CLASS OBJECT' COLOR 5.
    CALL METHOD OBJ1->DISPLAY. "THIS IS SUPER CLASS METHOD
    CALL METHOD OBJ1->MM1.
    CALL METHOD OBJ1->MM2.
    This example will help you to solve your problem.
    For more detailed information GOTO -> SAPTECHNICAL ->Tutorials -> Object Oriented Programming.
    Regards Madhu.
    Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:13 PM

  • Binding of a dependency property in a userControl does't work!

    public static readonly DependencyProperty myTBProperty =
    DependencyProperty.Register("myTB", typeof(decimal?), typeof(TB2), new FrameworkPropertyMetadata() { BindsTwoWayByDefault = true });
    public decimal? myTB
    get { return (decimal?)GetValue(myTBProperty); }
    set { SetValue(myTBProperty, value); }
    <TextBox Grid.Column="1" Text="{Binding myTB,Mode=TwoWay}" Width="{Binding TBWidth}"/>
    The above code is for a UserControl. 
    Now I used this UserControl into another UserControl like this:
    <c:TB2 myText="OutSide Diameter" myTB="{Binding Di,Mode=TwoWay}" TBWidth="120"/>
    private decimal? _Di;
    public decimal? Di
    get { return _Di; }
    set
    _Di = value;
    NotifyPropertyChanged();
    But when I change the Value of Di, nothing happens. I have also tried with an ordinary TextBox and it works. 

    You cannot explicitly set the DataContext of the TB2 UserControl.
    Give TB2 a name in the XAML markup:
    <UserControl x:Class="WpfApplication1.TB2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:WpfApplication22"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300" Name="tb2">
    ...and bind to the myTB property of the UC using the ElementName syntax:
    <TextBox Grid.Column="1" Text="{Binding myTB,Mode=TwoWay, ElementName=tb2}" Width="{Binding TBWidth}"/>
    Do not set the DataContext of TB2 to itself programmatically because then you cannot bind to the Di source property in the other UC.
    Please remember to close your threads by marking helpful posts as answer and please upload a reproducable sample of your issue to OneDrive and post the link to it here if you need any further help. It is impossible for anyone but you to know what is going
    on behind the scenes in your application.

  • JAXBContextImpl nor any of its super class is known to this context

    Hi,
    I have a XSD, generated classes from it. At runtime, i have included DAS/lib/classes.jar. getting below exception. Can somebody help?
    javax.xml.bind.JAXBException: class com.sun.xml.bind.v2.runtime.JAXBContextImpl nor any of its super class is known to this context.
         at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:596)
         at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:482)
         at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
         at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
         at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
         at vodafone.commerce.fulfillment.processor.ProcSubmitOrder.getMessageStr(ProcSubmitOrder.java:249)
         at vodafone.commerce.fulfillment.processor.ProcSubmitOrder.sendSubmitOrderMessage(ProcSubmitOrder.java:177)
         at vodafone.commerce.fulfillment.processor.ProcCheckOrderToGoForManualReview.runProcess(ProcCheckOrderToGoForManualReview.java:114)
    Thanks
    Gopi

    Ok I found it out
    jboss was using the jre default axis impelmentation while the server where my client was deployed was using the axis 2 implementation
    I changed the server to use jre default axis and things worked now
    Thanks
    Sapan

  • Error while calling a super class public method in the subclass constructor

    Hi ,
    I have code like this:
    CLASS gacl_applog DEFINITION ABSTRACT.
      PUBLIC SECTION.
        METHODS:
                create_new_a
                   IMPORTING  pf_obj       TYPE balobj_d
                              pf_subobj    TYPE balsubobj
                              pf_extnumber TYPE string
                   EXPORTING  pfx_log_hndl TYPE balloghndl
                   EXCEPTIONS error
    ENDCLASS.
    CLASS gacl_applog IMPLEMENTATION.
      METHOD create_new_a.
        DATA: ls_log TYPE bal_s_log.
      Header aufsetzen
        MOVE pf_extnumber TO ls_log-extnumber.
        ls_log-object     = pf_obj.
        ls_log-subobject  = pf_subobj.
        ls_log-aluser     = sy-uname.
        ls_log-alprog     = sy-repid.
        ls_log-aldate     = sy-datum.
        ls_log-altime     = sy-uzeit.
        ls_log-aldate_del = ls_log-aldate + 1.
        CALL FUNCTION 'BAL_LOG_CREATE'
             EXPORTING
                  i_s_log      = ls_log
             IMPORTING
                  e_log_handle = pfx_log_hndl
             EXCEPTIONS
                  OTHERS       = 1.
        IF ( sy-subrc NE 0 ).
          MESSAGE ID      sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH    sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                  RAISING error.
        ENDIF.
      ENDMETHOD.
    CLASS gcl_applog_temp DEFINITION INHERITING FROM gacl_applog.
      PUBLIC SECTION.
        DATA: log_hndl   TYPE balloghndl READ-ONLY
            , t_log_hndl TYPE bal_t_logh READ-ONLY
        METHODS: constructor
                   IMPORTING  pf_obj       TYPE balobj_d
                              pf_subobj    TYPE balsubobj
                              pf_extnumber TYPE string
                   EXCEPTIONS error
               , msg_add      REDEFINITION
               , display      REDEFINITION
    ENDCLASS.
    CLASS gcl_applog_temp IMPLEMENTATION.
      METHOD constructor.
        CALL METHOD create_new_a
               EXPORTING  pf_obj       = pf_obj
                          pf_subobj    = pf_subobj
                          pf_extnumber = pf_extnumber
               IMPORTING  pfx_log_hndl = log_hndl.
        IF ( sy-subrc NE 0 ).
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                  RAISING error.
        ENDIF.
      ENDMETHOD.
    A public method of Super class has been called from the constructor of the sub class. we are getting the syntax error :
    ' In the constructor method, you can only access instance attributes, instance methods, or "ME" after calling the constructor of the superclass…'
    Can you please suggest how to change the code with out affecting the functioanlity.
    Thank you ,
    Lakshmi.

    Hi,
    Call that method by instance of Subclass.   OR
    SUPER-->method.
    Read very useful document
    Constructors
    Constructors are special methods that cannot be called using CALL METHOD. Instead, they are called automatically by the system to set the starting state of a new object or class. There are two types of constructors - instance constructors and static constructors. Constructors are methods with a predefined name. To use them, you must declare them explicitly in the class.
    The instance constructor of a class is the predefined instance method CONSTRUCTOR. You declare it in the public section as follows:
    METHODS CONSTRUCTOR
            IMPORTING.. [VALUE(]<ii>[)] TYPE type [OPTIONAL]..
            EXCEPTIONS.. <ei>.
    and implement it in the implementation section like any other method. The system calls the instance constructor once for each instance of the class, directly after the object has been created in the CREATE OBJECT statement. You can pass the input parameters of the instance constructor and handle its exceptions using the EXPORTING and EXCEPTIONS additions in the CREATE OBJECT statement.
    The static constructor of a class is the predefined static method CLASS_CONSTRUCTOR. You declare it in the public section as follows:
    CLASS-METHODS CLASS_CONSTRUCTOR.
    and implement it in the implementation section like any other method. The static constructor has no parameters. The system calls the static constructor once for each class, before the class is accessed for the first time. The static constructor cannot therefore access the components of its own class.
    Pls. reward if useful....

  • How to get the subclass from a super class( or interface)

    hi,
    I want to get subclass from a super class (or a interface), how to do that? the subclass of a interface means the class implementing the interface.
    for example;
    List ls;
    I want to get the subclass of ls, i.e., LinkedList, Stack, Vector......
    AbstractList al;
    the subclass of al, i.e., ArrayList, Vector.......
    thanks
    Aiwu

    List ls = new ArrayList();Since ls has been declared as a List we can only use List methods
    with it. This is a good thing because we might later want to change
    it to some other sort of List.
    I want to get subclass from a super class (or a interface), how to do
    that?The instance of the subclass declared above did not really come
    from the super class. A class "knows nothing" about its
    subclasses: many sub classes would not even exist at the time
    the class was written.

  • Problem with subclass and super class

    here is the things i wanted to do
    /*Write a method that takes the time as three integer arguments (hours, minutes and seconds),
    and returns the number of seconds since the last time it was twelve o'clock.
    Write a program that uses this method to calculate the amount of time in seconds between two times,
    assuming both are within one twelve hour cycle of a clock.
    here is a class to find the last time closes to 120'clock in sec.
    import java.io.*;
    public class Timer {
         int converter = 60;
         int secinTwelveHour = 43200;
         int converter2 = 12;
    public int timerTime (int hour, int min, int sec){
              int totalSec = 0;
              //Finding the time
              if (hour > 0 && hour <= 24 && min > 0 && min <=60 && sec > 0 && sec <= 60 && hour <= 11){
                   //find last 12 o'Clock
                   hour = converter2 + hour;
                   //change to sec time
                   totalSec = (hour * converter * converter) + (min * converter) + sec;
              }else{     
         if (hour > 0 && hour <= 24 && min > 0 && min <=60 && sec > 0 && sec <= 60 && hour >= 12){
                   //find last 12 o'Clock in sec
                   totalSec = ((hour * converter * converter) + (min * converter) + sec) - secinTwelveHour;
         }else{
              return -1;
    }//End of return -1      
              }//End of first else statment
         return totalSec;     
         }//End of timerTimer
    }//End of Program     
    and here is the super class which uses the class aboved
    import java.io.*;
    public class FindTime {
    public int find2Time (int totalSec1, int totalSec2){
              int timeSec = 0;
              if(Timer.totalSec1 > Timer.totalSec2)
              timeSec = Timer.totalSec1 - Timer.totalSec2;
              else
              timeSec = Timer.totalSec2 - Timer.totalSec1;
         return timeSec;     
         }//End of find2Time
    public static void main( String [] arg){
         // Construct an instance of the Timer class
              Timer timerClass = new Timer();
              // Make a couple of calls of the method
              int totalSec1 = timerClass.timerTime(12, 3, 45);
              int totalSec2 = timerClass.timerTime(14, 23, 60);
              timeSec1 = find2Time (totalSec1, totalSec2)
              // Now print the values we got back
              System.out.println("Last closes Sec to 12 o'clock" + totalSec1);
              System.out.println("Last closes sec to 12 o'clock" + totalSec2);
              System.out.println("Last closes sec to 12 o'clock" + timeSec);
         }//End of main method
    }//End of Program     
    Now i'm having program with the compliing can anyone help me out like tell me what i'm doing wrong and give me a bit of a code so that i can have a push start
    thanks you

    Does this do what you want? It is in two seperate classes.
    import java.io.*;
    public class FindTime {
    public static void main( String [] arg){
    int timeSec = 0;
    // Construct an instance of the Timer class
         Timer timerClass = new Timer();
         // Make a couple of calls of the method
         int totalSec1 = timerClass.timerTime(12, 3, 45);
         int totalSec2 = timerClass.timerTime(14, 23, 60);
         timeSec = java.lang.Math.abs(totalSec1-totalSec2);
         // Now print the values we got back
         System.out.println("Last closes Sec to 12 o'clock " + totalSec1);
         System.out.println("Last closes sec to 12 o'clock " + totalSec2);
         System.out.println("Last closes sec to 12 o'clock " + timeSec);
         }//End of main method
    }//End of Program
    import java.io.*;
    public class Timer {
    int converter = 60;
    int secinTwelveHour = 43200;
    int converter2 = 12;
    public int timerTime (int hour, int min, int sec){
         int totalSec = 0;
         //Finding the time
         if (hour > 0 && hour <= 24 && min > 0 && min <=60 && sec > 0 && sec <= 60 && hour <= 11){
         //find last 12 o'Clock
         hour = converter2 + hour;
         //change to sec time
         totalSec = (hour * converter * converter) + (min * converter) + sec;
         } else {
         if (hour > 0 && hour <= 24 && min > 0 && min <=60 && sec > 0 && sec <= 60 && hour >= 12){
         //find last 12 o'Clock in sec
         totalSec = ((hour * converter * converter) + (min * converter) + sec) - secinTwelveHour;
         } else {
              return -1;
         }//End of return -1
    }//End of first else statment
    return totalSec;
    }//End of timerTimer
    }//End of Program

  • How to inherit super class constructor in the sub class

    I have a class A and class B
    Class B extends Class A {
    // if i use super i can access the super classs variables and methods
    // But how to inherit super class constructor
    }

    You cannot inherit constructors. You need to define all the ones you need in the subclass. You can then call the corresponding superclass constructor. e.g
    public B() {
        super();
    public B(String name) {
        super(name);
    }

  • Calling a method from a super class

    Hello, I'm trying to write a program that will call a method from a super class. This program is the test program, so should i include extends in the class declaration? Also, what code is needed for the call? Just to make things clear the program includes three different types of object classes and one abstract superclass and the test program which is what im having problems with. I try to use the test program to calculate somthing for each of them using the abstract method in the superclass, but its overridden for each of the three object classes. Now to call this function what syntax should I include? the function returns a double. Thanks.

    Well, this sort of depends on how the methods are overridden.
    public class SuperFoo {
      public void foo() {
         //do something;
      public void bar(){
         //do something
    public class SubFoo extends SuperFoo {
       public void foo() {
          //do something different that overrides foo()
       public void baz() {
          bar(); //calls superclass method
          foo(); //calls method in this (sub) class
          super.foo(); //calls method in superclass
    }However, if you have a superclass with an abstract method, then all the subclasses implement that same method with a relevant implementation. Since the parent method is abstract, you can't make a call to it (it contains no implementation, right?).

  • Overwriting a method of a super class in the subclass ???

    Hi,
    can somebody tell me whether it's possible to add a new implementation of a method in the sub class which is inherited from a super class?
    I want to model my program in that way:
    1. I define a super class with some implemented methods.
    2. This class should be inherited in a sub class. One method should be used as it was implemented in the super class but another method should be overwritten in the subclass.
    I know this concept from Java but I couldn't find a way how to do it in ABAP
    Many thanks for any help!
    Best regards,
    Birgit

    hi,
    yeas you can do it,
    Subclass can re-implement  the inherited public and protected methods from superclass.Class C1 contains method METH1(public) and METH2(protected), both of which are modified and re-implemented in  its subclass C2.also you can have ur own methods in subclass.Objects are created out of both classes and the method METH1 for both objects are called.
    Output of the program demonstrates different behaviour for method METH1 of class C1 and C2.
    This demonstrates the theme.
    REPORT YSUBDEL.
    CLASS C1 DEFINITION.
      PUBLIC SECTION.
       METHODS : METH1.
      PROTECTED SECTION.
       METHODS METH2.
      ENDCLASS.
    CLASS C1 IMPLEMENTATION .
      METHOD : METH1.
       WRITE:/5 'I am meth1 in class C1'.
       CALL METHOD METH2.
      ENDMETHOD.
      METHOD : METH2.
       WRITE:/5 ' I am meth2 in class C1 '.
      ENDMETHOD.
    ENDCLASS.
    CLASS C2 DEFINITION INHERITING FROM C1.
    PUBLIC SECTION.
      METHODS : METH1 redefinition,
      meth3.
    PROTECTED SECTION.
      METHODS : METH2 redefinition.
    ENDCLASS.
    CLASS C2 IMPLEMENTATION.
    METHOD METH1.
       WRITE:/5 'I am meth1 in class C2'.
       call method meth2.
    endmethod.
      METHOD : METH2.
      WRITE:/5 ' I am meth2 in class C2 '.
    ENDMETHOD.
    METHOD : METH3.
      WRITE:/5 ' I am own method of class C2'.
    ENDMETHOD.
    endclass.
    START-OF-SELECTION.
      DATA : OREF1 TYPE REF TO C1 ,
             OREF2 TYPE REF TO C2.
      CREATE OBJECT :  OREF1 , OREF2.
      CALL METHOD : OREF1->METH1 ,
                    OREF2->METH1.
    hope it helps,
    regards

  • Calling the super class method from the subclass

    Hi all,
    I have a question about inheritence and redefinition of methods. Is it possible to call the superclass implementation of a method which is redefined in the subclass in another method of the subclass?There are possbilities like creation of an explicit super class instance or delegating the super class method implementation to another method which is also protected etc. What i mean is, is there a direct way of calling it?We have ,me,   as the reference for the instance we have(which is the subclass instance in this case), is there also a way of pointing the superclass implementation(with super we can reference in the subclass redefinition, my question is if we have such a parameter in other methods of the subclass too)
    Thanks in advance
    Sukru

    Hi,
    The super reference can only be used in redefined methods to call superclass implementation . So probably what you can do is use upcasting and access the required superclass implementation. I can think of only this way...;-)
    Ex data lr_super type ref to cl_superclass
    lr_super = lr_subclass.
    lr_super->method().
    ~Piyush Patil

Maybe you are looking for

  • Add a New field in Selection Screen of Transaction CNS0

    All, I need to create a new field in the selection screen of CNS0. Its a transaction (dialog) not a report. Please find the image (will give more info on where to add) http://img18.imageshack.us/img18/5319/cns0.gif What are the options Any exits of B

  • Memory Usage in WinTaskManger vs heap size

    hello, I have exactly the same problem as in the topic "Windows Task Manager vs. Heap", posted at Dec 10, 2004 5:17 AM, by jorgeHX. Here are the symptoms: 1) My application starts at 20MB seen by windows task manager 2) I use profiler to monitor the

  • Office 2010 Workgroup Templates

    Dear Community, We are currently having an issue where the clients are closing outlook and reciving a popup to save NormalEmail.dotm. The users do not have a normalemail.dotm file located under %appdata%\Microsoft\templates folder and when we add the

  • Why do we have to install a certificate, put a pin in the lockscreen?

    I tried to install a certificate, but are asked to put a PIN, leave the place the PIN you can enable the sliding mode lockscreen! In GB, this process was very simple, and does not alter the method of lockscreen. How to activate the certificate withou

  • Oracle FAILSAFE and CVE-2012-1675

    Folks, I'm running Oracle 10.2.0.3 {PATCH 29} on Windows32 with Oracle Failsafe 3.4.4.1. I've tried implementing the IPC fix and the dynamic_registration=OFF fix as prescribed and get the listener.log error listed below with either attempt. It doesn'