2005 Aug 01 8:32 PM
With ABAP Objects can you have multiple inheritance similar to C++
Thanks in advance
2005 Aug 01 8:34 PM
ABAP does not support multiple inheritance.
From the following link.....
<i>ABAP Objects does not support multiple inheritance, because one of the main design goals for ABAP Objects was to make it as simple as possible. With multiple inheritance (available in C++ or Eiffel), a subclass can inherit directly from more than one class. This inheritance relationship is a network instead of a tree. In multiple inheritance, the rules for the namespace of components become much more complicated and may lead to naming collisions. Another problem is the so-called diamond inheritance problem: If the classes c2 and c3 inherit from a class c1, both contain all the components of c1. Now, if class c4 becomes a subclass of both c2 and c3, the problem arises of how to merge the original components of c1 into c4. However, ABAP Objects supports most of the benefits of multiple inheritance (such as the reuse of common interfaces and a wider scope polymorphism) by the separate concept of interfaces, which circumvents naming collision and the diamond inheritance problem.</i>
Check out this link.
http://www.intelligententerprise.com/channels/applications/feature/archive/keller.jhtml
Please don't forget to award points for helpful answers. Thanks.
Regards,
Rich Heilman
2005 Aug 01 8:34 PM
ABAP does not support multiple inheritance.
From the following link.....
<i>ABAP Objects does not support multiple inheritance, because one of the main design goals for ABAP Objects was to make it as simple as possible. With multiple inheritance (available in C++ or Eiffel), a subclass can inherit directly from more than one class. This inheritance relationship is a network instead of a tree. In multiple inheritance, the rules for the namespace of components become much more complicated and may lead to naming collisions. Another problem is the so-called diamond inheritance problem: If the classes c2 and c3 inherit from a class c1, both contain all the components of c1. Now, if class c4 becomes a subclass of both c2 and c3, the problem arises of how to merge the original components of c1 into c4. However, ABAP Objects supports most of the benefits of multiple inheritance (such as the reuse of common interfaces and a wider scope polymorphism) by the separate concept of interfaces, which circumvents naming collision and the diamond inheritance problem.</i>
Check out this link.
http://www.intelligententerprise.com/channels/applications/feature/archive/keller.jhtml
Please don't forget to award points for helpful answers. Thanks.
Regards,
Rich Heilman
2005 Aug 01 8:35 PM
2005 Aug 01 8:57 PM
2005 Aug 01 8:36 PM
Hi,
ABAP Obects are more simular to Java. Single inheretance is done by superclass-subclass.
CLASS <subclass> DEFINITION INHERITING FROM <superclass>.
Multiply inheritance is done by interfaces.
INTERFACES <intf>.
http://help.sap.com/saphelp_me21sp2/helpdata/en/c3/225b5c54f411d194a60000e8353423/frameset.htm
Svetlin