2008 Feb 29 4:26 AM
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. "
2008 Feb 29 6:15 AM
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:
[Accessing the Inacessible - Local Classes within Global Classes|https://wiki.sdn.sap.com/wiki/display/ABAP/AccessingtheInacessible-LocalClasseswithinGlobalClasses]
Regards
Uwe
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. "
2008 Feb 29 6:02 AM
Hi
The root class is: c1.
parent class c1
child class c2
child classc3.
C3 class inherits the properties of c2 and c1 also.
In ABAP like Java, multiple inheritance is not allowed.
This is one of the way to achive multiple inheritence.
If it is helpful rewards points.
Regards
Pratap.M
2008 Feb 29 9:04 AM
>
> In ABAP like Java, multiple inheritance is not allowed.
> This is one of the way to achive multiple inheritence.
>
No. You achieve behaviour like multiple inheritence through interfaces, not subclassing.
Multiple inheritance in C++, for example, is when a class has 2 or more superclasses. Which would be something like Class c3 definition INHERITING FROM c1 and c2. ( When c2 is NOT a subclass of c1 ).
matt
2008 Feb 29 6:15 AM
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:
[Accessing the Inacessible - Local Classes within Global Classes|https://wiki.sdn.sap.com/wiki/display/ABAP/AccessingtheInacessible-LocalClasseswithinGlobalClasses]
Regards
Uwe
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |