Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

multiple inheritance

Former Member
0 Kudos
582

With ABAP Objects can you have multiple inheritance similar to C++

Thanks in advance

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
94

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

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
95

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

Former Member
0 Kudos
94

I think that's in the form of interfaces.

regards,

anand.

0 Kudos
94

Thank you all for the responses have awarded points

Former Member
0 Kudos
94

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