Reg. oops...implementation of abstract method in se24...have ur ponts..

Hi all,
In SE24 i made an abstract class & made a method abstract successfully.
Now i made another class that inherited my abstract class, it is showing my abstract method there.
Now when i want to give implementation to that method, but when i double click on that system is showing "method is abstract & has not yet redefined".
Pleas let me know..how i implement it..
Thanx in advance..
<b>Have ur point.s</b>

Hi
Inheritance Inheritance defines the implementation relationship between classes, in which one class (the subclass) shares the structure and the behavior defined in one or more other classes (superclasses). Note: ABAP Objects only allows single inheritance.
Inheritance is a relationship, in which one class (the subclass) inherits all the main characteristics of another class (the superclass). The subclass can also add new components (attributes, methods, and so on) and replace inherited methods with its own implementations.
<b>Single Inheritance</b>
ABAP Objects only has single inheritance.
A class may only have one direct superclass, but it can have more than one direct subclass. The empty class OBJECT is the root node of every inheritance tree in ABAP Objects.
<b>Relationship between Superclasses and Subclasses</b>
Common components only exists in  the superclass
        new components in the supercalss are automatically available in subclass
        amount of new coding is reduced ( programing by difference)
Subclass are extremely dependent on superclases
       white box reuse – subclass must possess detailed knowledge of the implementation of the superclass
<b>Inheritance: Syntax</b>
       Normally the only other entry required for subclasses is what has changed in relation to the direct superclass. Only additions are permitted in ABAP Objects, that  is, in a subclass you can "never take something away from a superclass". All components from the superclass are automatically present in the subclass.
<b>Class name defination.
    public section.
         methods. First name importing some type some type
                                        returning value(value) type some type.
   private section
          data : make type string..
Endclass.
Class name1 definition inheriting name
public section
       method. : get  returning value ( value) type get.
Priavte section.
   data : max type some type
endclass</b>
<b> Redefining methods</b>
The REDEFINITION statement for the inherited method must be in the same SECTION as the definition of the original method.
If you redefine a method, you do not need to enter its interface again in the subclass, but only the name of the method.
In the case of redefined methods, changing the interface (overloading) is not permitted; exception: Overloading is possible with the constructor.
Within the redefined method, you can access components of the direct superclass using the SUPER reference.
The pseudo-reference super can only be used in redefined methods.
reward if usefull

Similar Messages

  • Find all redefined implementations of abstract method

    Hi folks,
    always the same: I have an interface defining methods with interface parameters. Then I have 1..n inherited classes. If I change the methods parameters in the interface, I have to apply changes to all implementations.
    Also, having a methods name, I want to see all inherited implementations. Is there any way more convenient than poke manually through the object tree?
    Regards,
    Clemens

    Yes, it is easy: Right-click in the class interface, choose inheritance relations (Shift-F9).
    Too bad I can't reward points for the solution..
    Regards,
    Clemens

  • Reg. decimal airthmetic......have ur ponts.

    Hi all,
    I have a decimal field with 2 places....say A = 1234.12
    My requirement to put the decimal value in another variable B. eg.   now B should be equal to B = 12.
    Help me out..
    & <b>Have ur pont.s</b>

    check this
    data : v1 type p decimals 2 value '123.45',
           v2 type i,
           v3 type p decimals 2.
    v3 = v1.
    v3 = v3 * 100.
    v2 = v3  mod 100.
    write : / v2.
    regards
    shiba dutta

  • Getting error while creating abstract method

    hi folks,
    i facing issue for ABSTRACT Class.
    I am trying to create abstarct method, (refered example from saptechnical site),
    I created one attribute i-num, created one method AREA, in  implementation area , i made it as Abstract, then i did syntax check, then it is giving below error.
    *Class ZTEST_CLASS01_AB,Method AREA
    The abstract method "AREA" can only be implemented after its
    redefinition (METHODS AREA REDEFINITION).*
    i tried all the ways..
    created subclass for this, i writted some code in AREA of Sub-class, there it is giving dump, because first one is not activated properly..
    could you please somebody help me on this.
    Sri

    Hello Arshad,
    Create a class(ZABSTRACT) and make its type as Abstract( Which means atleast one of its methods is abstract)
    We can have abstract classes with all it's methods as non-abstract or concrete. A small example is given below:
    CLASS gcl_abstract DEFINITION ABSTRACT.
      PUBLIC SECTION.
        METHODS concrete. "Concrete
    ENDCLASS.                    "gcl_abstract DEFINITION
    *       CLASS gcl_abstract IMPLEMENTATION
    CLASS gcl_abstract IMPLEMENTATION.
      METHOD concrete.
        WRITE: / `I'm a concrete method`.
      ENDMETHOD.                    "concrete
    ENDCLASS.                    "gcl_abstract IMPLEMENTATION
    *       CLASS gcl_abstract_sub DEFINITION
    CLASS gcl_abstract_sub DEFINITION INHERITING FROM gcl_abstract.
      PUBLIC SECTION.
        METHODS concrete REDEFINITION.
    ENDCLASS.                    "gcl_abstract_sub DEFINITION
    *       CLASS gcl_abstract_sub IMPLEMENTATION
    CLASS gcl_abstract_sub IMPLEMENTATION.
      METHOD concrete.
        super->concrete( ).
        WRITE: / 'Abstract class might not have abstract methods at all!'.
      ENDMETHOD.                    "concrete
    ENDCLASS.                    "gcl_abstract_sub IMPLEMENTATION
    START-OF-SELECTION.
      DATA: go_abstract TYPE REF TO gcl_abstract_sub.
      CREATE OBJECT go_abstract.
      go_abstract->concrete( ).
    Although i will agree there is no point in making a class as abstract & having no abstract method
    @Sri: Looks like you're trying to implement the abstract method "AREA" in the abstract class hence the error. For abstract method you cannot define their implementation in the corres. abstract class.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 30, 2011 12:04 PM

  • Can abstract method be overridden

    "An abstract method can be overridden by an abstract method"
    If an abstract method does not have any implementation, then what does one mean by overriding an abstract class in the subclass. Any code to show this will be of better understanding.
    Thanks..

    As yawmark demonstrated it can be use to to increase visibilty but it can also be used to reduce exception declarations.
    Example:
    abstract class A
        abstract void f() throws java.io.IOException, java.sql.SQLException;
    abstract class B extends A
        abstract void f() throws java.net.SocketException;   
    }

  • How to find the abstract method?

    Hello all,
    I have a quick question.
    If there is an abstract class with few abstract methods in it, how can we know which one is abstract method in SE24 ?
    Is there any setting to display all the abstract methods in SE24?
    And, all the methods are getting displayed in SE24 in such a way that
    <Interface1>
         method1
         method2
    <Interface2>
         method1
         method2
    Is it possible to display only the methods without its interface name?
    Thank you.
    -Ezhno.

    Hi Ezhno,
    In methods tab of se24, select the method &
    Click on detail view icon i.e. 4th button after Parameter, Exception & code button, there you can see attributes of method , there is a checkbox for 'Abstract'.
    Thanks,
    Sharath

  • Abstract Method Error and XML Parsing

    I am using wl6sp1. I am parsing an XML file from within the
    servlet using jaxp1.1 and crimson.
    Following is code:
    1- SAXParserFactory spf = SAXParserFactory.newInstance();
    2- sp = spf.newSAXParser();
    3- xr = sp.getXMLReader();
    4- xr.setContentHandler(new ParseXML());
    5- xr.parse( new InputSource("Example3.xml"));
    This program works fine when execute from command line but in servlet on line
    3 it says:
    "Abstract Method Error"
    I have created XML Registry to use Crimson as XML parser rather than default.
    I think somehow wl is still using jaxp1.0 which is built in
    support in wlsp1.
    Whats wrong with the code...or what configuration i am missing???

    I'm assuming you have already put crimson.jar first in the classpath for the java
    command you use to start WebLogic. If so, have you tried putting the servlet in
    a .war file with the crimson.jar in its' WEB-INF/lib directory?
    Regards,
    Mike Wooten
    "anyz" <[email protected]> wrote:
    >
    I am using wl6sp1. I am parsing an XML file from within the
    servlet using jaxp1.1 and crimson.
    Following is code:
    1- SAXParserFactory spf = SAXParserFactory.newInstance();
    2- sp = spf.newSAXParser();
    3- xr = sp.getXMLReader();
    4- xr.setContentHandler(new ParseXML());
    5- xr.parse( new InputSource("Example3.xml"));
    This program works fine when execute from command line but in servlet
    on line
    3 it says:
    "Abstract Method Error"
    I have created XML Registry to use Crimson as XML parser rather than
    default.
    I think somehow wl is still using jaxp1.0 which is built in
    support in wlsp1.
    Whats wrong with the code...or what configuration i am missing???

  • Reg. OOPs....abstract class....have ur ponts.

    Hi all,
    I m made an abstract class in SE24. i took 2 methods, 1 with implemetation & other with just definition
    Now i m taking another class...making class1 as super class.
    but now how i give code to my method2....
    Pleas assist me..
    <b>Have ur ponts.</b>
    Regards,
    pradeep phogat

    Hello,
    USE Keyword <b>REDEFINITION</b>
    Eg.
          CLASS passenger_plane  DFINITION INHE
    CLASS passenger_plane DEFINITION INHERITING FROM lcl_airplane.
      PUBLIC SECTION.
        METHODS :  constructor IMPORTING in_name TYPE ch1 in_planetype TYPE
    saplane-planetype in_n_o_seats TYPE sflight-seatsmax.
        <b>METHODS : display_attributes REDEFINITION.</b>
      PRIVATE SECTION.
        DATA : n_o_seats TYPE sflight-seatsmax.
    ENDCLASS.
          CLASS passenger_plane IMPLEMENTATION
    CLASS passenger_plane IMPLEMENTATION.
      METHOD constructor.
        CALL METHOD super->constructor EXPORTING in_name = in_name
    in_planetype = in_planetype.
        n_o_seats = in_n_o_seats.
      ENDMETHOD.
      METHOD display_attributes.
        CALL METHOD super->display_attributes.
        WRITE : / 'No of Seats inside the Passenger Plane = ' , n_o_seats.
        uline.
      ENDMETHOD.
    endclass.
    Regards,
    LIJO

  • Abstract method which when implemented will have different parameters

    Hello to all,
    I have an assignment but not looking for someone to do it for me. I am only searching for a suggestion on how to do the following.
    Imagine having an application that needs to provide an estimate of the rent for different buildings.
    Basically I start with by having a class name Building. This class has an abstract method called estimateRent.
    I then create two classes that extend the class Building which are named Apartment and House. Both need to have the method estimateRent.
    However the problem is that the rent for the Apartment is calculated on the nights passed in the flat and the people in it, while the rent for the House is just calculated on a month bases.
    This means the estimateRent method requires to have different parameters depending if it is implemented inside the Apartment class or the House class.
    Now I only know of two options.
    The first option is to not declare the estimateRent method as an abstract method inside the Building class and just implemented inside the Apartment and House with different parameters. I do not like this option since in the future if a new Building comes in then I would like to impose the fact that that object needs to have a calculate method.
    The second option is to make the estimateRent method as abstract inside the Building class however takes a parameter of either a String array or else a Map. Then the estimateRent within the Apartment class would search for the elements tagged as nights and people, and the House class would only search for the elements tagged as months!
    However do not know if there are any other, better ways on how to do this. I am using Java 1.4 however if you only have answers for Java 5.0 then please post them again since I always like to learn something new :)
    Thank You for any comments.
    tx

    The implementation changes, yes.Yes that I could understand in the Strategy Pattern (in the document I read it was being compared with the Template Pattern).
    Then you need to refactor your design.I tought about that, however if you read my first post you will notice that I have different criteria on which the costs need to be estimated. While the costs for a flat are estimated on the people staying in and nights slept there, the costs for the house are based only on the months stayed there regardless of the people living in. Now for me I feel that it is bad programming practice to create one method that can have all the parameters required for any scenario. I mean the following is NOT something I am going to do:
    estimateCosts(int nights, int people, int months ... etc);
    That's not a very elegant way of going about it.
    What is the "Context" going to have?Yep I agree, but so far my limited brain has only come up with that! I am open to any other sugestion! always if i understand it first!
    Basically the Context would better be named as Criteria and it would be an interface as follows:
    interface Criteria{}
    Then I would create two classes that implement the Criteria object as follows:
    class AppartmentCriteria implements Criteria{
    public Result estimateCosts(int nights, int people);
    class HouseCriteria implements Criteria{
    public Result estimateCosts(int months);
    Now when I recieve the inputs, depending on the scenario the Criteria is typecasted and the correct parameters passed and we recieve the Result.
    I feel the above sucks since I am not seeing it as an object oriented way of doing this out! Is there any other sugestions! The refactoring thing I am intrested in! however really I can not see how such a call to that method could be refectored!
    Thank You,
    tx.
    PS: Sun has blocked my other account as well, and this time they did not even send me an email to confirm that I was registered successfuully :( Is there someone I can contact on this? I guess next time I will reply with tx53m :)

  • Abstract Method in a Class with implemented method

    I have a class which already has methods Implemented.I mean thse metgods are not abstract.I want only one method to be abstarct which will be overrideen by its subclass or derived Class
    I have never tried this
    Does anyone knows how to do this
    If yes could you give me syntax of the method
    Thanks in advance
    CSJakharia

    javax.swing.JComponent is an example of an abstract
    class with no abstract methods. That is why the
    following works:
    JComponent component = new JComponent(){};
    Not to forget you cannot instantiate abstarct classes
    public abstract class Test
    public String getName()
    return "Mike";
    public static void main(String[] args)
    Test tt = new Test();
    System.out.println(tt.getName());
    }and you would get the error
    The type Test cannot be instantiated.
    You remove the abstract keyword and it would compile
    good.No I am not misinterpreting I know what he is saying but I am closing the door of misinterpretation which I felt was possible. ;)
    cheers

  • Why am i able to use abstract methods id they aren't yet implemented?

    For example, why i can use this [http://docs.oracle.com/javase/7/docs/api/java/nio/CharBuffer.html#slice] if this is abstract?
    Edited by: 947971 on 13-set-2012 10.38

    947971 wrote:
    Yes, but if CharBuffer has a method declared:
    public abstract CharBuffer slice()So i can't use the method slice() because it's not implemented.
    And why , indeed, i'm able to use it?Because it is implemented by the actual class being used. You can't instantiate abstract classes, so there is a subclass of CharBuffer which does implement the method.
    If you take the interface Comparable, you see that it has an (implicitly)abstract method compareTo. A class that implements Comparable is Integer, so you can easily write:
    Comparable<Integer> i = new Integer(100);
    i.compareTo(new Integer(55));

  • Implementing abstract methods

    Hello guys,
    I have a LPQueue class that implements a interface PQueue
    Here are the fiels:
    //PQueue interface
    import java.util.Iterator;
    interface PQueue<E extends Comparable<E>>
      public void insert(E x);
      public E peekMax();
      public E deleteMax();
      public int size();
      public void clear();
      public Iterator<E> iterator();
    //LPQueue class
    import java.util.*;
    import java.util.Iterator;
    public class LPQueue<E extends Comparable<E>> implements PQueue<E>
         private Node<E> first;
         private int size;
         public LPQueue(){
              first = null; //pointing to the first element
              size = 0;
         public void insert(E x){
              Node <E> tmp = new Node<E>(x);
              size++; //when we call insert we want to increase size by one to keep the size of queue current
              Node <E> p = first; //p points to first element
              Node <E> q = null; //this points to null initially because q has to stay behind p
              while(p != null && x.compareTo(p.data) > 0){
                   q = p;
                   p = p.next;
              if(q == null){
                   tmp.next = first;
                   first = tmp;
              else{
                   tmp.next = p;
                   q.next = tmp;
         public E peekMax(E x){
              if(size == 0){
                   throw new NoSuchElementException();
              if(x.compareTo(first.data) > 0){
                   return x;
              }else return first.data;
         public E deleteMax(E x){
              Node <E> tmp;
              if(size == 0){
                   throw new NoSuchElementException();
              if(x.compareTo(first.data) > 0){
                   first.data = null;
                   return x;
              }else
                   tmp = first;
                   first.data = null;
              return tmp.data;
         public int size(){
              return size;
         public void clear(){
              size = 0;
              first = null;
         public Iterator<E> iterator()
             return new LQIterator();
         private class LQIterator implements Iterator<E>{
              public Node<E> current;
              private LQIterator()
                  current = first;
                public boolean hasNext()
                    return current !=null;
                public E next()
                    if(!hasNext()){
                        throw new NoSuchElementException();
                    E x = current.data;
                    current = current.next;
                    return x;
                public void remove()
                    throw new UnsupportedOperationException();
         //seting up static Node class
         private static class Node <E>{
              public E data; //seting up paramtere data for node
              public Node<E> next; //
              public Node(E x){ //sting up constructor for Node passing the paramter x to data
                   data = x;
    }When i try to compile i get :
    The type LPQueue<E> must implement the inherited abstract method PQueue<E>.deleteMax() LPQueue.java
    The type LPQueue<E> must implement the inherited abstract method PQueue<E>.peekMax() LPQueue.java
    I have written the definition for both the peekMax and deletMax methods why am i still getting the above error?
    Thank you for your help,
    -Lovac

    The method signatures of the interface must match up exactly with the implementing classes. In the interface, neither method signature accepted a parameter, but in your concrete class, they do, and this just won't work.

  • The type must implement the inherited abstract method???

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.ActiveEvent;
    import java.applet.*;
    public class MoveIt extends Applet implements ActionListener
         private Image cup;
         private Panel keyPad;
         public int yaxis = 15;
         public int xaxis = 15;
         private Button keysArray[];
         public void init()
              cup = getImage(getDocumentBase(), "cup.gif");
              Canvas myCanvas = new Canvas();
              setBackground(Color.blue);
              setLayout(new BorderLayout());
              Button up = new Button("Up");
              Button down = new Button("Down");
              Button right = new Button("Right");
              Button left = new Button("Left");
              Button center = new Button("Center");
              add(myCanvas, BorderLayout.NORTH);
              add(keyPad, BorderLayout.SOUTH);
              keyPad.add(up, BorderLayout.NORTH);
              up.addActionListener(this);
              keyPad.add(down, BorderLayout.SOUTH);
              down.addActionListener(this);
              keyPad.add(right, BorderLayout.EAST);
              right.addActionListener(this);
              keyPad.add(left, BorderLayout.WEST);
              left.addActionListener(this);
              keyPad.add(center, BorderLayout.CENTER);
              center.addActionListener(this);
         public void paint( Graphics g )
              g.drawImage( cup, xaxis, yaxis, this );
         public void ActionPerformed(ActionEvent e)
              String action = e.getActionCommand();
              if(action.equals("Up"))
                   yaxis = yaxis - 15;
              if(action.equals("Down"))
                   yaxis = yaxis + 15;
              if(action.equals("Left"))
                   xaxis = xaxis - 15;
              if(action.equals("Right"))
                   xaxis = xaxis + 15;
              if(action.equals("Center"))
                   xaxis = 125;
                   yaxis = 60;
    }How come there is an error:
    The type MoveIt must implement the inherited abstract method
    ActionListener.actionPerformed(ActionEvent)
    What the hell does that mean?

    A class that implements an interface must define the methods of the interface. Your applet (or the one you borrowed) states at the top that it implements the ActionListener interface. If you go to the API, you'll see that this interface declares a method "actionPerformed", and so this class must have a method that matches the one in the interface. I see that your applet will have some Buttons. You'll need an actionPerformed method if you want the buttons to use your class (this) as their action listener.
    Edit: I see that you already have an "ActionPerformed" method, but note that case matters, and this is not the same as "actionPerformed". Change one letter and you're on your way.
    Edited by: Encephalopathic on Jan 15, 2008 8:44 PM

  • Implementation of java.sql.* abstract methods

    Hi to u all,
    Can someone tell me where the abstract methods in some interfaces in the java.sql package are implemented?
    For example:
    -- START CODE --
    ResultSet rs = null;
    try
    ps = db().prepareStatement("select * from aTable where x=?");
    ps.setInt(1, aValue);
    rs = ps.executeQuery();
    ResultSetMetaData md = rs.getMetaData();
    -- END CODE --
    It's about the getMetaData()-call.
    It returns information about the column names in the resultset.
    If I open the declaration (eclipse) the abstract method getResultSet() in the interface ResultSet in the java.sql-package is shown.
    So where is the actual implementation of the method??
    As a collegue told me he suspected the implementation is probably somewhere in the driver-software. If this is the case, how does the JVM know to find it there?
    Thx in advance for your time and answer(s)

    The JDBC driver implements the JDBC API.
    The JVM how to know that?
    1. The Class.forName("jdbc driver name") will load the driver into memory.
    2. The DriverManager.registerDriver(Driver driver) will register the driver for later use.
    Check the DriverManager.java for more detail.

  • Should @Override apply to implementation of interface/abstract methods?

    To me this is a minor but irritating incompatibility between Java 5 and 6. In 5 the @Override annotation only applied when an actual concrete method was overridden. In 6 it also applies when an interface or abstract method is implemented.
    To my mind only the first case is actually overriding. Further the purpose of the @Override, AFAIKS, is to catch errors where you accidentally override a method, or write a method which you expect to override another, but get the signature wrong.
    This kind of error isn't going to happen on implementing a method because you will get a real syntax error.
    If we were going to use annotations to guarantee implementation it should be @Implements

    sabre150 wrote:
    masijade. wrote:
    Having spend some time recently changing from extending abstract classes to implementing interfaces I would hate to have two different annotations!It would be annoying, yes, in that case, but it would still be more "technically" correct to have a different tag. And, if we are going to insist that "newbies" here at least attempt to adhere to standards/procedures/whatever, we should be willing to do the same. ;-)It would be more "technically" correct to have an 'override' key word in the same way as in C# . The annotation approach is used to make up for a deficiency in the language specification. If one applies the KISS principle or the 'principle of least surprise' then just having one annotation makes sense.Okay then, we agree to disagree. But getting even farther away in the "use" of the term as opposed to the "definition" of the term isn't helping to make up for the deficiency in the language.
    Of course, in the practical sense it is better to have one as it is, then, least likely to "break" in a backwards compatability sense (even when it only applies to compilation and not execution).

Maybe you are looking for

  • Installing 11gr2 in Oracle Linux 6.3 (./runInstaller - permission denied)

    Whenever i try to run ./runInstaller in terminal, i get the error as Permission denied , While installing oracle linux 6.3 , i have given root password and in terminal , even though being a root user, can't install the Oracle Database 11gr2. I know,

  • Elearning suite to Learning Management System (LMS) - how-to from an InDesign file?

    We need to be able to export InDesign files to a portable SCORM format that could be loaded into various Learning Management Systems (LMS) – however, it is not obvious how we would do this? We need to publish our documents both in a book\PDF format a

  • Mass Creation of Appraisal Documents

    Hello HR Experts, I want to create appraisal documents in bulk. After an investigation I come to know that, It can be achieved using BAdi HRHAP00_DOC_PREPARE2 and just I need to create a copy of the standard program RHXHAP_APP_DOC_PREPARE_ORG. Is am

  • How to make a bind variable out of a comparison like statement

    I have a statement similar to the following - select x from atable where acolumn like '1%'; How do I turn that into a variable in an anonymous block like - declare l_var varchar2(1) := '1'; begin select x from atable where acolumn like 'l_var%' end;

  • JDBC Datasource creation via ANT doesn't expose the JNDI name

    I'm using the wlconfig ANT task to create a Datasource (& JDBC connectionpool) on the weblogic server. The datasource is created fine, and I can test it using the console. The problem is that the provided JNDI name isn't exposed in the JNDI tree. Thi