Methods Implemented in Other Classes

Dear all,
In our system I found such a class. In t-code SE24, some of its method names are displayed in blue fonds, instead of ordinary black fonds. When I double click on the method names, a pop-up window indicates "Method xxx is implemented in class yyy". I have no idea about the relationship between the original class and the class yyy. Can anybody explain such a situation?
Thanks + Best Regards
Jerome

Hello Jerome
If you display class CL_GUI_ALV_GRID in transaction SE80 and open the folder "Methods" you will see which method will be displayed in "blue":
- all methods in sub-folder <b>Inherited Methods</b> are shown in blue
- some of these inherited methods have been redefined within the class (folder Redfinitions) and are displayed in "ordinary" black font
Which is the superclass of CL_GUI_ALV_GRID? Simply display the <b>Properties </b>tabstrip of the class. There you see that CL_GUI_ALV_GRID_BASE is the superclass.
Thus, all methods displayed in blue are methods inherited from the superclass that have not been redefined.
Regards
  Uwe

Similar Messages

  • Understanding method implementation for LinkedList class

    Hello
    I'm new to java and just trying to get my head around data structures, particularly ArrayList and LinkedList implementations. I've looked at the Sun API for both classes, but would like to see how the methods are implmented so I can venture into writing my own versions of these classes..
    Does anyone know if there is a resource showing the full method implementation so I can view how they work?
    thanks,

    a really strange licence: look but don't touch, and it's still under copyrightThis license seems to make sense: you can look at it and learn from it but you are not supposed to make an own, incomptabile version.

  • How to invoke methods from an other class?

    Hello,
    I've got the following problem I can't solve:
    I have a class that extends JApplet (viewtiff) and another that displays the images (DisplayJAI). Now I have implemented the MouseListener in DisplayJAI and on a right-click it should execute a method located in viewtiff.
    If viewtiff would be created by myself with the new operator, this wouldn't be a problem. I just had to write instance_name.method() to invoke it, but in this case I don't know the instance name of my viewtiff class because it gets created by the JApplet I think.
    Defining viewtiff static would help, but this isn't possible for the 'main' class in an applet. What can I do now?
    Many thanks,
    Sebastian Tyler

    in the constructor// in ViewApplet:
    ViewTIFF vt = new ViewTIFF (this);
    // in ViewTIFF:
    class ViewTIFF {
    private ViewApplet va;
    public ViewTIFF (ViewApplet va) {
    this.va = va;
    void someMethod () {
    va.someMethod ();
    }>> a setter method// in ViewApplet:ViewTIFF vt = new ViewTIFF ();
    vt.setViewApplet (this);
    // in ViewTIFF:
    class ViewTIFF {
    private ViewApplet va;
    public void setViewApplet (ViewApplet va) {
    this.va = va;
    void someMethod () {
    va.someMethod ();

  • JTextArea stop work after a method involke by other class

    This is my code:
    * Console.java
    * Created on November 5, 2007, 5:23 PM
    package javaapplication6;
    import java.io.IOException;
    import java.lang.String;
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.PrintWriter;
    import java.net.Socket;
    * @author  root
    public class Console extends javax.swing.JFrame {
        private LoadFirmware    loadfirmware;
        /** Creates new form Console */
        public Console() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jPanel1 = new javax.swing.JPanel();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            jButton3 = new javax.swing.JButton();
            jButton4 = new javax.swing.JButton();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            jMenuBar1 = new javax.swing.JMenuBar();
            jMenu1 = new javax.swing.JMenu();
            jMenuItem1 = new javax.swing.JMenuItem();
            jMenuItem2 = new javax.swing.JMenuItem();
            jMenu2 = new javax.swing.JMenu();
            jMenuItem3 = new javax.swing.JMenuItem();
            jMenuItem4 = new javax.swing.JMenuItem();
            jMenuItem5 = new javax.swing.JMenuItem();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("append");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jButton2.setText("Exit");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton2ActionPerformed(evt);
            jButton3.setText("Switch to Program Mode");
            jButton3.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton3ActionPerformed(evt);
            jButton4.setText("Switch to Run Mode");
            jButton4.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton4ActionPerformed(evt);
            jTextArea1.setColumns(20);
            jTextArea1.setRows(5);
            jScrollPane1.setViewportView(jTextArea1);
            org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .add(jButton1)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jButton3)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jButton4)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jButton2)
                    .addContainerGap(170, Short.MAX_VALUE))
                .add(jPanel1Layout.createSequentialGroup()
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 622, Short.MAX_VALUE)
                    .add(20, 20, 20))
            jPanel1Layout.linkSize(new java.awt.Component[] {jButton1, jButton2}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
            jPanel1Layout.linkSize(new java.awt.Component[] {jButton3, jButton4}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 247, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 90, Short.MAX_VALUE)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jButton1)
                        .add(jButton3)
                        .add(jButton4)
                        .add(jButton2))
                    .add(98, 98, 98))
            jMenu1.setText("File");
            jMenuItem1.setText("New");
            jMenu1.add(jMenuItem1);
            jMenuItem2.setText("Open");
            jMenu1.add(jMenuItem2);
            jMenuBar1.add(jMenu1);
            jMenu2.setText("Tool");
            jMenuItem3.setText("Load Firmware");
            jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    load_firmware(evt);
            jMenu2.add(jMenuItem3);
            jMenuItem4.setText("Start Console Service");
            jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    StartService(evt);
            jMenu2.add(jMenuItem4);
            jMenuItem5.setText("Monitor");
            jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenuItem5ActionPerformed(evt);
            jMenu2.add(jMenuItem5);
            jMenuBar1.add(jMenu2);
            setJMenuBar(jMenuBar1);
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap())
            pack();
        }// </editor-fold>
        private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {                                          
            CmdHandle loadMon = new CmdHandle();
            loadMon.main(null);
        private void StartService(java.awt.event.ActionEvent evt) {                             
                try {
              //Process proc = Runtime.getRuntime().exec("java MyTest");
              Runtime rt = Runtime.getRuntime();
              String[] cmd={"cmd.exe" , "/c" , "start" ,"c:/cygwin/home/root/ugconsole/main.exe"};
                    //String[] cmd={"c:/cygwin/home/root/ugconsole/main.exe"};
              rt.exec(cmd);
              //System.out.println("***Executed java MyTest***");
         } catch (IOException e) {e.printStackTrace();}
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            appendmsg("apn msg\n");
        private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            Tcp cmd = new Tcp();
            cmd.PID_SwToRunMode();
        private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            Tcp cmd = new Tcp();
            cmd.ProgramMode();
        private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            System.exit(0);
        private void load_firmware(java.awt.event.ActionEvent evt) {                              
            loadfirmware.main(null);
        public static void PROGRAMPAGE(){
            String command = "PROGRAMPAGE";
            writer.print(command);
            writer.flush();
          //  appendmsg(command);
            try {
                String response = reader.readLine();
                System.out.println(response);
            } catch (IOException ex) {
                ex.printStackTrace();
        public static void appendmsg(String msg){
           // jTextArea1.append("but this ok le");
            jTextArea1.append(msg);
            System.out.println(msg);
        public static void main(String args[])
             throws IOException
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Console().setVisible(true);
            final int DEST_PORT = 20000;
            s = new Socket("localhost", DEST_PORT);
            in = s.getInputStream();
            out = s.getOutputStream();
            reader = new BufferedReader(new InputStreamReader(in));
            writer = new PrintWriter(out);
            //String asd = "asd";
            //writer.print(asd);
           // writer.flush();
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton3;
        private javax.swing.JButton jButton4;
        private javax.swing.JMenu jMenu1;
        private javax.swing.JMenu jMenu2;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenuItem jMenuItem1;
        private javax.swing.JMenuItem jMenuItem2;
        private javax.swing.JMenuItem jMenuItem3;
        private javax.swing.JMenuItem jMenuItem4;
        private javax.swing.JMenuItem jMenuItem5;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JScrollPane jScrollPane1;
        public static javax.swing.JTextArea jTextArea1;
        // End of variables declaration
        private static Socket s;
        private static InputStream in;
        private static OutputStream out;
        private static BufferedReader reader;
        private static PrintWriter writer;   
    }After PROGRAMPAGE() is call, appendmsg() won't work anymore.
    anyone can help ? thank!
    Edited by: mjava on Nov 15, 2007 7:26 PM

    -> After PROGRAMPAGE() is call, appendmsg() won't work anymore.
    How do you know? That method isn't invoked anywhere in your posted code.
    We don't all use JDK6 so we don't all have access to GroupLayout. Design a demo that we can all run that duplicates your problem.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
    see http://homepage1.nifty.com/algafield/sscce.html,
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

  • Enums with constant-specific method implementation

    Just faced the following problem. I have a persistent class with one of the fields of it is enum with constant-specific method implementation:
    @Persistent
    public class Message
       static public enum Type
           DEFAULT
               @Override
               public String getDescription() { return "Some description"; }
           public abstract String getDescription();
       private Type type;
    }When I try to store the record, I get the exception:
    java.lang.IllegalArgumentException: Class could not be loaded or is not persistent: messages.Message$Type$1The problem seem to be in that compiler creates a separate class, namely Message$Type$1.class for the DEFAULT instance and this class is not known by BDB..
    If I remove the constant-specific method from enum, everything's working fine (as the ..$1.class is not created by compiler).. Except the fact that I'd like to have constant-specific methods there..
    Any ideas on this? Maybe it's a bad idea to create constant-specific methods if it means that each constant would get own class file (and they would bloat the storage routines)?

    Hi Mikhail,
    I recreated the problem here and you're right, constant-specific methods aren't working. This isn't something we thought about, to be honest, or tested.
    Just based on an initial quick look I see that for the compiler generated class, the Class.isEnum method returns false, which is why we don't recognize this as an enum and eventually why we throw the exception you're seeing. But assuming that we can identify the class as an enum (that shouldn't be too difficult) I don't know what other problems we will run into in trying to support this.
    For now I think the best thing is to avoid using the constant-specific methods. I have opened a ticket (#18357) so that we'll remember to look into this in more detail and see whether it can be supported in the future.
    If we are able to support it, then I'm hoping that we won't to store extra metadata for constants that have methods. In other words, I'm hoping that we won't have to add any extra storage or processing overhead.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to implement the String class "split()" method (JDK1.4) in JDK 1.3

    is it possible , with some code, to implement the split() method of the String class......which is added in JDK1.4 ..... in JDK1.3
    would be helpful if anyone could suggest some code for this...

    Here it is
    public static String[] split(String source, char separ){
    answer=new Vector();
    int position=-1, newPosition;
    while ((newPosition=source.indexOf(separ,position+1))>=0){
    answer.add(source.subString(position+1,newPosition));
    position=newPosition;
    } //while
    answer.add(source.subString(position+1,source.length-1);
    return (String[])(answer.toArray());
    } //split

  • Implementation of the hasProperties() method of the Node class

    The following snippet of code prints:
    false
    true
    which seems to be a bug.
    TextField nameField = new TextField();
    System.out.println(nameField.hasProperties());
    ObservableMap<Object, Object> props = nameField.getProperties();
    System.out.println(nameField.hasProperties());The implementation of the hasProperties() method in the Node class returns true, if the ObservableMap object for storing properties has been created. That is not what is expected from this method. I think, this method should also check if the ObservableMap has any properties.
    Can someone confirm that it is a bug?
    Thanks
    Kishori

    You can log it at http://javafx-jira.kenai.com and then, if the developers want to keep it the way it is (which they may for API compatibility purposes), they can at least document it so that a user would know what to expect without writing a test or making a potentially invalid assumption.

  • Use methods in other classes

    Can I use methods from other classes than the class that myClass extends?
    ex. myClass extends parentClass{
    myMethod()
    myMethod() is declared in i third class. Is this possible or can I only use classes from the parent class?
    -Thanks-

    I'm not really sure what the previous two answers were getting at.
    Yes, you can use methods all the way up the class hierarchy, as long as they are visible.
    For example, Object implements toString(). You can call toString() on any object in Java and it will render the object to a string in one way or another. That is because toString() is public.
    If toString() were protected, you would only be able to call the method if you were a subclass of of that object (or in the same package), which would make the toString() method much less useful.
    I would suggest reading up on the differences in the four visibility modifiers (private, (default), protected, and public). Private is the only one which nothing else can call. If you are public or protected, any subclass can call the method, even if there are 20 superclasses between the implementor and the caller.
    Good luck!
    Steve

  • Why the method be implemented in EntityManager.class

    package javax.persistence;
    public interface EntityManager
         // Methods
         void persist(java.lang.Object p1) { }
         T merge(T p1) { }
         void remove(java.lang.Object p1) { }
         T find(java.lang.Class<T> p1, java.lang.Object p2) { }
         T getReference(java.lang.Class<T> p1, java.lang.Object p2) { }
         void flush() { }
         void setFlushMode(javax.persistence.FlushModeType p1) { }
         javax.persistence.FlushModeType getFlushMode() { }
         void lock(java.lang.Object p1, javax.persistence.LockModeType p2) { }
         void refresh(java.lang.Object p1) { }
         void clear() { }
         boolean contains(java.lang.Object p1) { }
         javax.persistence.Query createQuery(java.lang.String p1) { }
         javax.persistence.Query createNamedQuery(java.lang.String p1) { }
         javax.persistence.Query createNativeQuery(java.lang.String p1) { }
         javax.persistence.Query createNativeQuery(java.lang.String p1, java.lang.Class p2) { }
         javax.persistence.Query createNativeQuery(java.lang.String p1, java.lang.String p2) { }
         void joinTransaction() { }
         java.lang.Object getDelegate() { }
         void close() { }
         boolean isOpen() { }
         javax.persistence.EntityTransaction getTransaction() { }
    }

    This is the first time I saw this usage. I understood it now, but I was afraid I missed some important concepts on "interface as parameter in the constructor". Therefore, I am wondering where I can find some online document about it in order to understand the usage clearly.
    For example, if there are a few method implementations of interface TreeModel in MyDataModel.java, which methods will it call after calling JTree constructor? all methods or only part of them?
    Thanks

  • Is Two Classes that call methods from each other possible?

    I have a class lets call it
    gui and it has a method called addMessage that appends a string onto a text field
    i also have a method called JNIinterface that has a method called
    sendAlong Takes a string and sends it along which does alot of stuff
    K the gui also has a text field and when a button is pushed it needs to call sendAlong
    the JNIinterface randomly recieves messages and when it does it has to call AddMessage so they can be displayed
    any way to do this??

    Is Two Classes that call methods from each other possible?Do you mean like this?
       class A
         static void doB() { B.fromA(); }
         static void fromB() {}
       class B
         static void doA() { A.fromB(); }
         static void fromA() {}
    .I doubt there is anyway to do exactly that. You can use an interface however.
       Interface IB
         void fromA();
       class A
         IB b;
         A(IB instance) {b = instance;}
         void doB() { b.fromA(); }
         void fromB() {}
       class B implements IB
         static void doA() { A.fromB(); }
         void fromA() {}
    .Note that you might want to re-examine your design if you have circular references. There is probably something wrong with it.

  • Methods of class contained in an other class

    Hello,
    i would like to know is there is another way than  what i do with classes embeded in another:
    ex i have a device classe that containe a class Com (rs232 ...)
    what i do whan i want to setup a com of a device is get com objet of device then appliing change on COM with com methodes
    is there a way to apply com methode directly to Device ?  i thought about putting get instr method in Com class so unbundle is done directly
    but i don't think this is a good thing ...
    Is there something to do with friend class or community ?
    see attached .jpg
    Regards
    Tinnitus
    CLAD / Labview 2011, Win Xp
    Mission d'une semaine- à plusieurs mois laissez moi un MP...
    RP et Midi-pyrénées .Km+++ si possibilité de télétravail
    Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
    Don't forget to valid a good answer / pensez à valider une réponse correcte
    Solved!
    Go to Solution.
    Attachments:
    classes methodes.jpg ‏25 KB

    Hi Tinnitus,
    I think you are talking about "inheritance".
    Inheritance means that you have a "parent" class and a "child" class.
    The "child" is a special type of "parent". Such as a "dog" is a special type of "animal".
    The child class has access to all the methods and properties of the parent class.
    And the child class can have additionnal methods/properties that the more generic class doesnt have.
    It is also possible to overide the methods in the child class to customize them.
    For more information about this concept:
    LabVIEW Object-Oriented Programming: The
    Decisions Behind the Design
    http://zone.ni.com/devzone/cda/tut/p/id/3574
    In the LabVIEW project explorer, you can go to the properties of a class, and define this class as the child of another class (modify inheritance).
    Then, when you instantiate the child class, the object can access the methods/properties of it's parent class.
    However, if you instantiate the parent class, the object won't be able to access the methods that are specific to the child class.
    The parent class is more generic than the child class.
    Hope this will help.
    Best regards,
    Thomas B. | CLAD
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Inscrivez-vous gratuitement aux Journées Techniques : de l'acquisition de données au contrôle/com...

  • Calling methods from other classes

    I have a bunch of little java files in a folder, do I need to make a package in order to access all the methods in all the classes, or can I just make an instance of any of the methods because all the classes are in the same folder?

    HI,
    If your methods have a "public" modifier (and the class does too) then you can instantiate your classes as objects from that (so-called) "default" package in any other class or object in any other package and then call the methods on those instantiated objects as you please.
    If that sounds confusing... I'd seriously try the excellent tutorials at this site, especially "the java tutorial".
    /k1

  • Method not accessible from other classes

    Hi,
    I ve defined a class and would like to create an instance of it from another class. That works fine, I am also able to access class variables. However the class method "calcul" which is defined as following, is not accessible from other classes:
    class Server {
    static String name;
    public static void calcul (String inputS) {
    int length = inputS.length();
    for (int i = 0 ; i < length; i++) {
    System.out.println(newServer.name.charAt(i)); }
    If I create an instant of the class in the same class, the method is then available for the object.
    I am using JBuilder, so I can see, which methods and variables are available for an object. Thanks for your help

    calcul is a static method, that means you do not need an instance of server to run this method. This method is also public, but your class Server is not, your Server class is package protected. So only classes within the same package has Server can use its method. How to use the calcul method?// somewhere in the same package as the Server class
    Server.calcul( "toto" );

  • 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

Maybe you are looking for