Doubt in inheritance tree..!

hi SAP Guru's !
here is My example :
Class c1 definition.
endclass.
Class c2 definition INHERITING FROM c1.
endclass..
Class c3 definition INHERITING FROM c2.
endclass.
Out of these which one is the root node of inheritance tree  ?
   and
what is the meaning of this (empty class object )
" the root node on all inheritance trees in ABAP Objects is the predefined EMPTY class OBJECT. "

Hello Rajesh
The root of all classes in ABAP is the class OBJECT.
Think about an itab in which you want to store instances of any kind of class. What kind of linet_type do you use for your itab?
If, for example, all your collected instances are sub-classes of your c1 class (or c1 itself) then you could use your class C1 as line_type.
If the collected instances do not belong to a single inheritance tree then you must use class OBJECT as line_type.
Example: Have a look at the iterator class CL_SWF_UTL_ITERATOR and its attribute MT_OBJECT_LIST where any kind of instances can be collected.
Further examples of how to use the iterator class or class OBJECT are:
Storing and retrieving objects from an internal table
[Accessing the Inacessible - Local Classes within Global Classes|https://wiki.sdn.sap.com/wiki/display/ABAP/AccessingtheInacessible-LocalClasseswithinGlobalClasses]
Regards
  Uwe

Similar Messages

  • Inheritance tree and interfaces

    Hello!
    Interface is not a part of inheritance tree. It means, that the next code is absolutely legal:
    class App{
           public static void main(String... args){
                    Bar bar = (Bar)new Foo();
    class Foo{}
    interface Bar{}You can compile it, run and get a ClassCastException.
    But if I write it so:
    final class Foo{}
    ...I'll get compilation error.
    I know how it works, but I don't understand why.
    Does anybody have any ideas?

    Ataraxisme++.
    Cue JLS :
    JLS sayz (emphasis added):
    5.1.6 Narrowing Reference Conversions
    The following conversions are called the narrowing reference conversions :
    ❋ From any reference type S to any reference type T, provided that S is a proper supertype (§4.10) of T. (An important special case is that there is a
    narrowing conversion from the class type Object to any other reference type.)
    ❋ From any class type C to any non-parameterized interface type K, provided that C is not final and does not implement K.
    ❋ From any interface type J to any non-parameterized class type C that is not final.
    ❋ From the interface types Cloneable and java.io.Serializable to any array type T[].
    ❋ From any interface type J to any non-parameterized interface type K, provided that J is not a subinterface of K.
    ❋ From any array type SC[] to any array type TC[], provided that SC and TC are reference types and there is a narrowing conversion from SC to TC.
    Such conversions require a test at run time to find out whether the actual reference value is a legitimate value of the new type. If not, then a ClassCastException is thrown.

  • Doubt in alv tree

    Hi friends,
    I am working in alv tree. It is working fine. In click event , if i click one item it should call another one tcode (it is also an another one tree strucutre ). i called that tcode using call transaction. it is working .
    now my question how to place cursor in the corresponding item of the second tree.
    Thanks
    Senthil Kumar.r

    Hi Senthil,
                       When you have builded the tree you will have filled node table with node key and text or fieldname .
    I mean something like this .
        node-node_key = ls_vbak-vbeln.
          node-relatkey = 'Orders'.
          node-relatship = cl_gui_simple_tree=>relat_last_child.
          node-text =  ls_vbak-vbeln.
          node-isfolder = ' '.
          node-expander = ''.
          APPEND node TO node_table.
    now call methode cl_gui_alv_tree->set_selected_item
                       exporting I_NODE_KEY = ls_vbak-vbeln. ( child node_key)
    In the above the example the first node item would be selected. but before this you should expand the node to select the item
    cl_gui_alv_tree->EXPAND_NODE
                  exporting I_NODE_KEY = ( parent node_key ).
    Please reward if useful.

  • SQL incorrect using pm.refresh on inheritance tree 2.5.3

    Hi, Sorry for the repeat post, but didn't get a response from the last one
    and I'm still searching for a solution
    I am getting unexpected behaviour when using the pm.refresh(Object) method.
    Refresh works correctly and reloads data if the lock has been updated on
    tables/objects with no inheritance. However, if I try to use refresh on an
    object that is part of an inheritance hierarchy, the query that is executed
    to get the jdolockx value is missing the table join.
    Example:
    Table Entity
    id
    displayname
    jdolockx
    jdoclassx
    Table Individual (inherits from Entity)
    id
    firstName
    lastName
    jdolockx
    Query executed when calling refresh and passing in Individual
    SELECT
    t0.JDOLOCKX
    FROM
    ENTITY t0,
    INDIVIDUAL t1
    WHERE
    t1.ID = 1151
    Problem
    Missing crucial join t1.ID = t0.ID
    These classes work correctly with correct SQL when inserting/selecting.
    Any help is greatly appreciated.
    Regards
    Nathan Boyes

    I've changed the metadata configuration so that jdolockx is defined only in
    the base class and the query is still missing the join.
    I have attached the metadata files I'm using.
    (SELECT t0.JDOLOCKX FROM Bean t0, MQBean t1 WHERE t1.id = ?):
    [reused=1;params={(int)460}]
    "Stephen Kim" <[email protected]> wrote in message
    news:[email protected]...
    How is your metadata configured? JDOLOCKX should only be defined at the
    base class level.
    begin 666 MQBean.jdo
    M/#]X;6P@=F5R<VEO;CTB,2XP(B!E;F-O9&EN9STB551&+3@B/SX-"@T*/&ID
    M;SX-"B @(" \<&%C:V%G92!N86UE/2)T82YE=F5N="(^#0H@(" @(" @(#QC
    M;&%S<R!N86UE/2)-44)E86XB('!E<G-I<W1E;F-E+6-A<&%B;&4M<W5P97)C
    M;&%S<STB0F5A;B(@:61E;G1I='DM='EP93TB87!P;&EC871I;VXB/@T*(" @
    M(" @(" @(" @/&5X=&5N<VEO;B!V96YD;W(M;F%M93TB:V]D;R(@:V5Y/2)T
    M86)L92(@=F%L=64](DU10F5A;B(O/@T*(" @(" @(" @(" @/&9I96QD(&YA
    M;64](G-E<G9E<B(^#0H@(" @(" @(" @(" @(" @/&5X=&5N<VEO;B!V96YD
    M;W(M;F%M93TB:V]D;R(@:V5Y/2)I9"UD871A+6-O;'5M;B(@=F%L=64](E-%
    M4E9%4DE$(B\^#0H@(" @(" @(" @(" \+V9I96QD/@T*(" @(" @(" @(" @
    M/&9I96QD(&YA;64](F5V96YT5'EP92(^#0H@(" @(" @(" @(" @(" @/&5X
    M=&5N<VEO;B!V96YD;W(M;F%M93TB:V]D;R(@:V5Y/2)I9"UD871A+6-O;'5M
    M;B(@=F%L=64](D5614Y45%E014E$(B\^#0H@(" @(" @(" @(" \+V9I96QD
    M/@T*(" @(" @(" @(" @/&9I96QD(&YA;64](G%U975E36%N86=E<B(^#0H@
    M(" @(" @(" @(" @(" @/&5X=&5N<VEO;B!V96YD;W(M;F%M93TB:V]D;R(@
    M:V5Y/2)D871A+6-O;'5M;B(@=F%L=64](E%5155%34%.04=%4B(O/@T*(" @
    M(" @(" @(" @/"]F:65L9#X-"B @(" @(" @(" @(#QF:65L9"!N86UE/2)Q
    M=65U94YA;64B/@T*(" @(" @(" @(" @(" @(#QE>'1E;G-I;VX@=F5N9&]R
    M+6YA;64](FMO9&\B(&ME>3TB9&%T82UC;VQU;6XB('9A;'5E/2)1545514Y!
    M344B+SX-"B @(" @(" @(" @(#PO9FEE;&0^#0H@(" @(" @(" @(" \9FEE
    M;&0@;F%M93TB8VAA;FYE;"(^#0H@(" @(" @(" @(" @(" @/&5X=&5N<VEO
    M;B!V96YD;W(M;F%M93TB:V]D;R(@:V5Y/2)D871A+6-O;'5M;B(@=F%L=64]
    M(D-(04Y.14PB+SX-"B @(" @(" @(" @(#PO9FEE;&0^#0H@(" @(" @(" @
    M(" \9FEE;&0@;F%M93TB;VY-97-S86=E365T:&]D(CX-"B @(" @(" @(" @
    M(" @(" \97AT96YS:6]N('9E;F1O<BUN86UE/2)K;V1O(B!K97D](F1A=&$M
    M8V]L=6UN(B!V86QU93TB3TY-15-304=%34542$]$(B\^#0H@(" @(" @(" @
    M(" \+V9I96QD/@T*(" @(" @(" \+V-L87-S/@T*(" @(#PO<&%C:V%G93X-
    '"CPO:F1O/@``
    `
    end
    begin 666 Bean.jdo
    M/#]X;6P@=F5R<VEO;CTB,2XP(B!E;F-O9&EN9STB551&+3@B/SX-"@T*/&ID
    M;SX-"B @(" \<&%C:V%G92!N86UE/2)T82YE=F5N="(^#0H@(" @(" @(#QC
    M;&%S<R!N86UE/2)"96%N(B!O8FIE8W1I9"UC;&%S<STB=&$N:60N0F5A;DE$
    M(CX-"B @(" @(" @(" @(#QE>'1E;G-I;VX@=F5N9&]R+6YA;64](FMO9&\B
    M(&ME>3TB8VQA<W,M8V]L=6UN(B!V86QU93TB2D1/0TQ!4U-8(B\^#0H@(" @
    M(" @(" @(" \97AT96YS:6]N('9E;F1O<BUN86UE/2)K;V1O(B!K97D](FQO
    M8VLM8V]L=6UN(B!V86QU93TB2D1/3$]#2U@B+SX-"B @(" @(" @(" @(#QE
    M>'1E;G-I;VX@=F5N9&]R+6YA;64](FMO9&\B(&ME>3TB=&%B;&4B('9A;'5E
    M/2)"96%N(B\^#0H@(" @(" @(" @(" \9FEE;&0@;F%M93TB:60B('!R:6UA
    M<GDM:V5Y/2)T<G5E(CX-"B @(" @(" @(" @(" @(" \97AT96YS:6]N('9E
    M;F1O<BUN86UE/2)K;V1O(B!K97D](F1A=&$M8V]L=6UN(B!V86QU93TB:60B
    M+SX-"B @(" @(" @(" @(#PO9FEE;&0^#0H@(" @(" @(" @(" \9FEE;&0@
    M;F%M93TB8V]N=')O;&QE<B(^#0H@(" @(" @(" @(" @(" @/&5X=&5N<VEO
    M;B!V96YD;W(M;F%M93TB:V]D;R(@:V5Y/2)I9"UD871A+6-O;'5M;B(@=F%L
    M=64](D-/3E123TQ,15))1"(O/@T*(" @(" @(" @(" @/"]F:65L9#X-"B @
    M(" @(" @(" @(#QF:65L9"!N86UE/2)E;F%B;&5D(CX-"B @(" @(" @(" @
    M(" @(" \97AT96YS:6]N('9E;F1O<BUN86UE/2)K;V1O(B!K97D](F1A=&$M
    M8V]L=6UN(B!V86QU93TB14Y!0DQ%1"(O/@T*(" @(" @(" @(" @/"]F:65L
    M9#X-"B @(" @(" @(" @(#QF:65L9"!N86UE/2)P;VQL:6YG26YT97)V86PB
    M/@T*(" @(" @(" @(" @(" @(#QE>'1E;G-I;VX@=F5N9&]R+6YA;64](FMO
    M9&\B(&ME>3TB9&%T82UC;VQU;6XB('9A;'5E/2)03TQ,24Y'24Y415)604PB
    M+SX-"B @(" @(" @(" @(#PO9FEE;&0^#0H@(" @(" @(#PO8VQA<W,^#0H@
    5(" @/"]P86-K86=E/@T*/"]J9&\^
    `
    end

  • Basic doubt in Inheritance

    Program
    class Test
         public int i = 3; 
         public static void main(String args[])
            Object o = (Object)new Test();
            Test foo = (Test)o;
            System.out.println("i = " + Test.i);
    When I compiled this program-1 I got a runime error saying NoClassDefFoundError
    Whereas when I compiled the below program-2 It did not report any error? gave a result of 3
    Program 2
    public class Testd
       public static void main(String args[])
          class Foo
             public int i = 3;
         Object o = (Object)new Foo();
         Foo foo = (Foo)o;
         System.out.println("i = " + foo.i);
    I am not able to understand about the explicit class casting process which took in both programs. Kindly explain if we can cast as in program 2, what could be reason for program one not running.Thanks for taking pain in explaining me.

    java -cp . YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    Javapedia: Classpath
    How Classes are Found
    Setting the class path (Windows)
    Setting the class path (Solaris/Linux)

  • Doubt About Tree

    Hi Experts,
    I have one doubt the SAP Tree How it will looks like
    What is sap Netweaver----->>>>Developer Studio
    >>>>Exchange Infrastructure
    >>>>Enterprise Portal
    >>>>WAS
    What is xApps????
    Please let me know How this Tree looks like What is the relation in between these all.Iam in confussion
    Ragadrs
    khanna

    The Web App Server is the platform to which other SAP products reside on top of.  So it would look something like this:
    Function / Module: SAP XI
    App Server: SAP WAS
    Database: Oracle
    <i>Or</i>
    Function / Module: SAP ECC
    App Server: SAP WAS
    Database: Oracle
    The Developer Studio stands alone and only resides on desktop PCs.  It can be used to write adapters to the SAP software if you want something custom.  For example, if SAP XI doesn't do something that you want it to do then you can write an adapter in the Developer Studio and then deploy it onto the XI server.

  • Inheritance problems

    I'm trying to work out a problem with a project I'm working on that uses inheritance.
    the superclass consists of a prebuild GUI using swing, when more then one class enherits from the superclass for some reason its like they are sharing the subclass, any changes to the GUI done in one subclass affects the other, so if I add a JScrollPane to the Container from the inherited class it stayes after the window is closed AND its there when the other subclass runs.
    What I want is for both subclasses to have their own instances of the subclass, or in other words I don't want the changes done in one subclass to affect the other subclass, is this possible?
    My best guess is that instead of getting their own copy of the subclass they are sharing the same one so when one subclass does any changes the other reflects those changes because they are working with the exact same instance of the superclass. I have an idea of what my problem is I just don't know how to stop it from hapening.

    It seems to me you are very confused as to how your inheritance tree works and from your description there is a clear design fault. It may well be you are diasy-chaining your classes and have got design in a fart with logic and flow - ie:
    class A{ // superclass
    class B extends A{} // so if B is an application GUI
    class C extends B{} // C gets messed up
    class D extends C{} // and application GUI D gets knackered too
    This type of design rarely works well (if at all). You need to literally go back to the 'drawing board' and consider what you're trying to do with good design principles.
    I'm not sure anyone here can really help you with this unless you give a detailed description of what you're trying to do (not code), though from what I CAN gather it should be something like;-
    class AllComponentsFrame{}
    /* class AmendedComponentsFrame1 extends AllComponentsFrame{} // maybe? */
    class FinalGUI1 extends AllComponentsFrame{}
    class FinalGUI2 extends AmendedComponentsFrame1 {}

  • Enumerate multiple inheritance scenarios and their java equivalents?

    hi,
    ppl have often said things like
    "java doesn't support multiple inheritance but this is ok, since there are other mechanisms for doing the same thing (by which we nearly always mean interfaces)"
    how solid a statement is this? are there any formal methods available eg smt like "over all possible inheritance trees over all possible classes, only a handful of cases are distinct when viewed from the converting-to-single-inheritance scheme"?
    the two things mentioned as harder to workaround are mixins and the diamond problem - are there more?
    also what other mechanism apart from interfaces (if any) are useful?
    any help appreciated,
    asjf

    What I say is that it doesn't matter since there is
    almost never any need for MI. Most of the time it is
    used it is used because the developer/designer did not
    understand what they were doing and it should not have
    been used in the first place.
    That leaves one with very few cases where it should
    ever be used. And that coupled with the fact that a
    developer should never use it unless they are very
    experienced (so that they actually know that it should
    be used,) means that practicing programmers should
    leave discussion of such usages to scholarly
    journals.thanks :) I guess my problem is that often with computer stuff you don't have to rely on other peoples experience about things - you can go and test it yourself
    I've done very little C++ development, and so have never come across real-world multiple inheritance. I bumped into the first situation with some java code where it might've been a neat solution recently but this could easily fit into the "designer did not understand what they were doing" category from above..
    will have a casual look around the scholarly journals if I can find any that look promising :)
    asjf

  • Inheritance Issue - constructor

    Okay, I hope you guys can help me out of this. I currently have an interface designed, with a class inheriting its information. Here is the sample code for reference:
    ArrayStack
    public class ArrayStack
        implements AnotherInterface
        public ArrayStack(int stacksize)
            stack = new String[stacksize];
        public boolean isFull()
            return top == stack.length;
    }Now the problem arises when I want to create a new class which inherits the ArrayStack. Here is a sample code of what I have wrote up:
    public class checkSize extends ArrayStack
        public checkSize()
    }I'm just trying to get my head around inheritance, but this code keeps giving me the error "cannot find symbol - constructor". Can anyone point me to the right direction or tell me what I can do? Any help would be greatly appreciated!

    Connex007 wrote:
    Melanie_Green wrote:
    So as suggested you can either call another constructor or you can create a default constructor in your superclass,Now that's where I'm getting confused on - what other constructor can I call?There is only one other constructor to call in the super class.
    Remember that the first line of every constructor is either an explicit or implicit call to another constructor. If you do not explicitly call another constructor then super() is inserted during compile time, and the default constructor that has no parameters of the superclass is called.
    Furthermore any class that does not explicitly extend another class, extends Object. So as I stated previously if the first line of the any constructor in this class is not a call to another constructor, then the compiler will insert super() which will invoke the default constructor of Object.
    Now in your scenario you are using inheritance, you have a subclass extending a superclass. Note that you have not defined a default constructor in the super class, which for example is defined in Object. So inside your subclass, if you do not call another constructor on the first line, then again the compiler will insert a call to super(). The call to super() from the subclass is dependent on the superclass having defined a default no parameter constructor. However in your case the superclass does not have such a constructor defined. Therefore you are still required to instantiate every class in the inheritance tree, either explicitly or implicitly.
    If you are still weary at this point, think of it this way. If A extends B extends C. When an object of type A is instantiated, a constructor of A then B then C is called so that C is instantiated first, then B, then A. This is reflective of instantiated in a top down method so that each subclass is instantiated correctly. Since A extends B, and B can potentially be instantiated in one or more ways, you still need to define how both A and B are instantiated.
    So relating this back to your problem, what are all the possible ways in which your superclass can be instantiated? We can eliminate the default constructor and assume that we must specify on the first line of the constructor contained in the subclass that a call to a constructor in the subclass or superclass occurs. If we invoke a constructor in the same class, in the subclass, then either this constructor calls a constructor in the super class, or it calls a constructor that in turn will tinkle its way up to calling a constructor in the superclass.
    Mel

  • No Calrity on Multiple Inheritance Concept Of Java..!

    In SCJP Book by "karty serie " .
    In Java
    a subclass of class Object, (except of course class Object itself). In other words, every
    class you'll ever use or ever write will inherit from class Object. You'll always have
    an equals method, a clone method, notify, wait, and others, available to use.
    Whenever you create a class, you automatically inherit all of class Object's methods.
    A class cannot extend more than one class. That means one parent per class. A
    class can have multiple ancestors, however, since class B could extend class A, and
    class C could extend class B, and so on. So any given class might have multiple
    classes up its inheritance tree, but that's not the same as saying a class directly
    extends two classes.
    class PlayerPiece extends GameShape, Animatable { // NO!
    // more code
    If the above code is invalid, is it legal to write the code like ...
    class PlayerPiece extends GameShape, Object { // NO!
    // more code
    Thanks In Advance
    Kiran

    I think I can help straighten out what is confusing you.
    Let's say you have a class B that extends class A, and a class C that extends class B.
    Then class C implicitly extends class A, but java does not allow you to make that explicit.
    So, yes, in a way, class C does subtype both class A and B, but it only directly subclasses class B. The subtyping of class A is implicit.
    The following should demonstrate some patterns that should help clear things up:
    class A { } 
    // This automatically is a subclass of Object,
    // you don't need to specify that.
    // or
    class A extends Object { } 
    // This is legal, but not necessary, since a class
    // that doesn't extend anything else implicitly extends Object
    class B extends A { } 
    // This directly subclasses class A,
    // and implicitly subtypes Object
    // but
    class B extends A, Object { } 
    // This is NOT legal in java, and will not compile,
    // even though the previous code would
    // make class B a subtype of Object
    class C extends A { } 
    // Again, a direct subclass of A,
    // and indirect subclass of Object
    class D extends B, C { } 
    // This is NOT legal in java, and is what people
    // usually mean when they say that multiple
    // inheritance is prohibited.  In this case, you
    // are attempting to subclass two different
    // classes, where one is *not* a subtype of
    // another.  There is no work around to make
    // this happen in java, but you can use interfaces
    // and composition to get a similar effect with a
    // bit of glue code to hook things together.
    // For example:
    interface X {
      public void doX();
    class XImpl implements X {
      public void doX() {
        // do something
    interface Y {
      public void doY();
    class YImpl implements Y {
      public void doY() {
        // do something else
    class Z implements X, Y {
      private X x = new XImpl();
      private Y y = new YImpl();
      public void doX() {
        x.doX();
      public void doY() {
        y.doY();
    // This is basically what goes on behind the scenes
    // in languages like C++ that do support MI

  • Integer column for type indication in inheritance structure?

    Hi,
    I'm struggling with the mapping of an inheritance tree. The classes;
    Person and SubPerson use a flat mapping schema, with an metadata-value
    indicator for the type of the class. The latter poses some problems. The
    database column that contains the type of the class is of type INTEGER
    (using
    DB2). Apparently Kodo does not support the mapping of metadata-value
    indicator to an INTEGER column in the database. Is this correct?
    Schema:
    <table>
    <column name="TYPE" type="INTEGER"/>
    </table>
    Mapping:
    <class name="Person">
    <jdbc-class-map type="base" table="PERSON"/>
    <jdbc-version-ind type="none"/>
    <jdbc-class-ind type="metadata-value" column="TYPE"/>
    <class/>
    <class name="SubPerson">
    <jdbc-class-map type="flat" table="PERSON"/>
    <jdbc-version-ind type="none"/>
    <class/>
    Metadata:
    <class name="SubPerson" persistence-capable-superclass="Person">
    <extension vendor-name="kodo" key="data-cache-timeout" value="
    -1"/>
    <extension vendor-name="kodo" key="jdbc-class-ind-value"
    value="1"/>
    </class>
    => exception when running:
    "The "class-column" attribute/extension for the class indicator on type
    "Person.<class-indicator>" names a column whose type is not compatible with
    the expected type.
    Kind Regards,
    Stijn

    You would have to put a numerical value as Person' jdbc-class-ind-value
    extension, even if its abstract.
    Stijn Van den Enden wrote:
    Hi,
    I'm struggling with the mapping of an inheritance tree. The classes;
    Person and SubPerson use a flat mapping schema, with an metadata-value
    indicator for the type of the class. The latter poses some problems. The
    database column that contains the type of the class is of type INTEGER
    (using
    DB2). Apparently Kodo does not support the mapping of metadata-value
    indicator to an INTEGER column in the database. Is this correct?
    Schema:
    <table>
    <column name="TYPE" type="INTEGER"/>
    </table>
    Mapping:
    <class name="Person">
    <jdbc-class-map type="base" table="PERSON"/>
    <jdbc-version-ind type="none"/>
    <jdbc-class-ind type="metadata-value" column="TYPE"/>
    <class/>
    <class name="SubPerson">
    <jdbc-class-map type="flat" table="PERSON"/>
    <jdbc-version-ind type="none"/>
    <class/>
    Metadata:
    <class name="SubPerson" persistence-capable-superclass="Person">
    <extension vendor-name="kodo" key="data-cache-timeout" value="
    -1"/>
    <extension vendor-name="kodo" key="jdbc-class-ind-value"
    value="1"/>
    </class>
    => exception when running:
    "The "class-column" attribute/extension for the class indicator on type
    "Person.<class-indicator>" names a column whose type is not compatible with
    the expected type.
    Kind Regards,
    Stijn
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Inheritance & Static Variables

    Just a technical question...
    Class A has a static Variable -staticVar
    Class B extends Class A but defines a static variable with the same Name -staticVar
    Class A has a nonstatic method init(String inputString) that does
    staticVar = inputString;
    When an instance of Class B is instantiated
    bObject = new B();
    aObject = new A();
    bObject.init("Now Initializing B");
    For some reason, the init function (in class A but available to Class B as it extends) initializes the static variable of A and not B.
    Let's say if Class B overrides the init method, then it is able to set the value of the static variable of B.
    Why is it doing that?
    My impression was that all the nonstatic methods are in the object level. (No longer in the class level.) So if I create an instance of Class B, any method (either inherited or not inherited) should refer to the static variables of Class B.
    Thanks,
    V.

    What you have discovered is called variable 'hiding'. When you declare B to have a variable that has the same name as one in A, they are two completely different varaibles.
    Variables and static methods are not polymorphic in Java. When the init method is executing, it doesn't search the class inheritance tree for the most specific version of the variable named staticVar. The variable that will be used is determined at compile time. The variable names are discarded by the compiler and never used by the VM.

  • TopLink caching policy and inheritance

    Just looking for some confirmation on TopLink caching policy behavior for descriptors involving inheritance.
    The TopLink workbench allows me to specify the "Identity" policy advanced property for descriptor that involve inheritance (subclasses).
    Subclass descriptors can have different identity policies right?
    I could have some subclasses (descriptors) which I wish to use a FullIdentityMap and other subclasses (descriptors) that I wish to have a SoftCacheWeakIdentityMap?
    Thanks for clarification. The manuals don't really clarify this behavior.
    ...Steve

    TopLink maintains one identity map (cache) per root class. That means that all settings are shared for an inheritance tree and cannot be overridden on a per class basis.
    Doug

  • Narrow Cast and Widening cast in OOPs

    hi friends,
    Can u please clear with the above two concepts ..... i have many doubts on this ...
    first of all Y we need the concept of Narrow cast and widenning cast ?
    Expecting your answers ...
    Thanks in advance
    Cheers
    Kripa Rangachari .....

    hi Kripa,
    “Narrowing” cast means that the assignment changes from a more specialized view (with visibility to more components) to a more generalized view (with visibility to fewer components).
    “Narrowing cast” is also referred to as “up cast” . “Up cast” means that the static type of the target variable can only change to higher nodes from the static type of the source variable in the inheritance tree, but not vice versa.
    <b>Reference variable of a class assigned to reference variable of class : object</b>
    class c1 definition.
    endclass.
    class c1 implementation.
    endclass.
    class c2 definition inheriting from c1.
    endclass.
    class c2 implementation.
    endclass.
    start-of-selection.
    data : oref1 type ref to c1,
            oref2 tyep ref to c2.
    oref1 = oref2.
    <b>Widening Cast</b>
    DATA:     o_ref1 TYPE REF TO object,                o_ref2 TYPE REF TO class.
    o_ref2 ?= o_ref1.
    CATH SYSTEM-EXCEPTIONS move_cast_error = 4.
         o_ref2 ?= o_ref1.
    ENDCATCH.
    In some cases, you may wish to make an assignment in which the static type of the target variable is less general than the static type of the source variable. This is known as a widening cast.
    The result of the assignment must still adhere to the rule that the static type of the target variable must be the same or more general than the dynamic type of the source variable.
    However, this can only be checked during runtime. To avoid the check on static type, use the special casting operator “?=“ and catch the potential runtime error move_cast_error
    Regards,
    Richa

  • RE: (forte-users) Forte ADE

    In addition to this confusion, I'd like to see some statement by Forte to
    indicate
    WHEN the next Forte R4 is scheduled (before the Sun era is was said to be
    Summer 2000) and
    WHAT exactly it will contain (major headings will do).
    With the cancellation of the Forte Forum event doubt and uncertainty are
    spreading in the
    Forte communities that I talk with and no one seems to counterbalance these
    doubts with an
    official statement. How serious does Sun take TOOL Forte for the coming few
    years? Release
    of Fusion V2 seems to say "serious". The deafning silence with regard to R4
    indicates the
    opposite. And the users are divided (as always).
    Theo de Klerk
    Architecture & Application Integration
    Professional Services
    Compaq Computer Corp. - the Netherlands
    -----Original Message-----
    From: Rottier, Pascal [mailto:Rottier.Pascalpmintl.ch]
    Sent: Tuesday, 18 April, 2000 17:49
    To: 'kamranaminyahoo.com'
    Subject: (forte-users) Forte ADE
    A long, long time ago
    In a galaxy far away....
    I saw a demonstration of Forte's new Application Development
    Environment,
    which was more userfriendly than the current one. It also looked more
    similar to the interface of the other development tools out
    there, with a
    tree structure and capabilities to browse through the
    inheritance tree, and
    not opening a new window for every project, class and method that is
    accessed.
    This new interface was supposed to be included in Forte 4, which would
    combine TOOL and Java and would be released soon.
    Since then, we've seen SynerJ and now FJEE, but Forte 4 is still not
    released. And when it will be released, it still won't
    support TOOL and Java
    simultaneously. That's OK. I understand that.
    But now I've heard that this improved ADE won't even be
    included in Forte 4.
    Is this true? And if so, why?
    Pascal
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe,
    send in a new
    email the word: 'Unsubscribe' to:
    forte-users-requestlists.xpedior.com

    You may be interested in the following which comes from a statement of direction
    recently issued by Sun.
    Product Context
    + Fort&eacute; 4GL is an award-winning, proven product with many unique advantages for
    building
    enterprise business systems that are distributed, that involve the integration
    of existing
    business systems as well as new functionality, and that target heterogeneous
    runtime
    environments.
    + Fort&eacute; 4GL is recognized by Gartner Group as the most successful Enterprise
    Application
    Development Tool.
    + Forte 4GL has a substantial customer base that has been successful with the
    product and that
    looks forward to using Fort&eacute; 4GL for new applications.
    + The Sun Microsystems, Inc. (SMI) development tools group (formerly Fort&eacute;
    Software, Inc.)
    has a strong internal commitment to Fort&eacute; 4GL. Fort&eacute; Fusion is written with, and
    is currently
    being enhanced with Fort&eacute; 4GL.
    + SMI has retained the Fort&eacute; field sales organization as an independent unit
    whose primary
    product offerings are Fort&eacute; 4GL and Fort&eacute; Fusion. Continued volume sales of
    Fort&eacute; 4GL
    remain the foundation of our business plan.
    Product Future
    + We intend to actively enhance and promote Fort&eacute; 4GL for the indefinite
    future.
    + We believe Fort&eacute; 4GL will flourish in the long term, especially if we are
    able to harness the
    considerable selling power of the entire SMI field sales organization. To make
    the product
    more attractive and easier to sell, we will continue to make the product more
    modular and
    easier to integrate with heterogeneous software environments.
    + We believe that the best opportunity for attracting new customers is to
    leverage the ability of
    Fort&eacute; 4GL to easily build powerful shared business services (server components)
    that can be
    accessed by non-Fort&eacute; clients (e.g., browsers, Java clients) and that can easily
    integrate with
    new and existing business systems.
    + We believe that Fort&eacute; 4GL?s continued success is enhanced by continuing to
    issue small and
    frequent product releases. Our target is two such releases per year.
    + There is a great potential for our three product lines (Fort&eacute; 4GL, Fort&eacute;
    Fusion, and Fort&eacute; for
    Java) to complement and reinforce each other. Interoperability among the three
    product lines
    is seen as a critical success factor for Fort&eacute; 4GL.
    Forte 4GL Statement of Direction Page 2
    Sun Microsystems, Inc Proprietary and Confidential
    Product Priorities
    1. Interoperability with third party software components
    + External (non-4GL) client support (e.g., browsers, Java clients)
    + External server integration (e.g., messaging, component support, data
    exchange)
    2. Enhanced productivity
    + Increased automation (i.e., less coding)
    + Support for platform updates (e.g., new versions of OS, DBMS)
    3. TOOL code to Java code migration
    4. Unified developer look and feel with other Forte development products
    5. Common repository
    Short Term Product Plans
    Mid-year release
    + New features available as ?preview? per the standard Forte maintenance
    release procedures
    + Tentatively labeled ?release 3.5? and distributed as a free product
    enhancement for
    customers under maintenance
    + Scheduled for Summer 2000
    + Defining features
    + Introspection (reflection) ? the ability for an object to describe itself at
    runtime
    + Improved integration with applications developed using Fort&eacute;-for-Java
    Community
    Edition
    + Platform support improvements to track important operating system and
    database
    vendor activity
    + Target features
    + Display system enhancements (e.g., Motif 2 support, line arrowheads, window
    refresh control, editable outline fields)
    + Dynamic library loading
    + Improved CORBA/IIOP support
    + Improved XML and XSLT class support
    + JMQ support
    New year release
    + New features available as ?preview? per the standard Forte maintenance
    release procedures
    + Tentatively labeled ?release 3.6? and distributed as a free product
    enhancement for
    customers under maintenance
    + Scheduled for year end 2000
    + Defining features
    + Any Release 3.5 target features that were not included in 3.5
    + Generation of EJB interfaces for R3 service objects
    + Platform support improvements to track important operating system and
    database
    vendor activity
    + Target features
    + COBOL record handling as part of the OS390 transaction adaptor
    + Improved runtime security
    + Interface classes for access to Netscape Server 4.0 and possibly other web
    servers
    Long Term Product Plans
    + To be determined by customer and market feedback.
    + A major criterion for new functionality will be enhancing the revenue
    generating ability of
    the product, thereby fostering its long-term health in the marketplace.
    + Substantial emphasis will be placed on creating new capabilities that enhance
    the
    attractiveness of the product for new users.
    + The contents of Release 3.7 (or whatever it will be called) will be
    solidified just after release
    3.5 ships. Subsequent planning visibility will be two forward releases.
    "Klerk, Theo de" <Theo.de.Klerkcompaq.com> on 04/18/2000 12:27:36 PM
    To: "'Rottier, Pascal'" <Rottier.Pascalpmintl.ch>,
    "'kamranaminyahoo.com'" <kamranaminyahoo.com>
    cc: (bcc: Charlie Shell/Bsg/MetLife/US)
    Subject: RE: (forte-users) Forte ADE

Maybe you are looking for

  • Issue with new Airport Extreme Base Station 802.11ac

    I just purchased an AEBS (new model with 802.11ac).  I'm using it with Comcast internet service using a Motorola Surfboard SB6121. I have a very odd and frustrating issue.  The internet simply blips in and out.  I have it set up with WiFi and have co

  • MDNSResponder can't recognize Computer Name or local hostname?

    When looking in Console Logs recently, I noticed log messages saying the mDNSResponder could not read user-specified Computer name or host name and using default names etc. Example: "Aug 18 13:46:23 dialup-4 mDNSResponder: Couldn't read User-specifie

  • Safari won't stay open

    I have mac os x 10.6.8, and safari 5.1.7, as of last week after accessing Neflix, which I've done many times before, safari quit unexpectedly, and now it won't stay open for more than about 30 seconds before it quits again.  I tried deleting it and r

  • Illustrator CC 2014 to Illustrator CS5 - Completely Uneditable?

    Hello all, I've built a set of packaging layouts in Illustrator CC 2014. After the fact, I found out that my client wants to edit the files in the CS5 version of the program. I exported the files from CC using the regular "save as CS5" function. Whil

  • Can iPhone messages not be received by Samsung galaxy

    Can iPhone messages no be received by Samsung Galaxy?