‎2007 Dec 27 4:37 AM
Hi Experts,
Plz could any one explain me about why multiple inheritance is not used in sap..
thanks in advance,
Sana..
‎2007 Dec 27 2:06 PM
Multiple inheritance is an idea where more than one class can be a superclass of a class. This is used in C++, for example. In Java and ABAP, the designers of the programming language decided this was a BAD idea, leading to ambiguity and contradiction - and therefore, programs that are more complicated and expensive to maintain.
So, the biggest reason is: the clever people at SAP decided not to allow multiple inheritance.
matt
‎2007 Dec 27 5:57 AM
Hi,
we need not to use multiple inheritence in ABAP because we are using Interfaces.
Interfaces are independent structures that you can implement in a class to extend the scope of that class.
a universal point of contact.
They provide one of the pillars of polymorphism, since they allow a single method within an interface to behave differently in different classes.
Global & Local Interfaces
The definition of a local interface <intf> is enclosed in the statements:
INTERFACE <intf>.
...
ENDINTERFACE.
The definition contains the declaration for all components (attributes, methods, events) of the interface.
They automatically belong to the public section
please reward points, if it is useful.
regards,
satish.
‎2007 Dec 27 2:06 PM
Multiple inheritance is an idea where more than one class can be a superclass of a class. This is used in C++, for example. In Java and ABAP, the designers of the programming language decided this was a BAD idea, leading to ambiguity and contradiction - and therefore, programs that are more complicated and expensive to maintain.
So, the biggest reason is: the clever people at SAP decided not to allow multiple inheritance.
matt
‎2012 May 21 7:29 AM
Hi ,
ABAP Objects does not support multiple inheritance to make it as simple as possible.
In multiple inheritance, If the classes a2 and a3 inherit from a class a1, both contain all the components of a1. Now, if class a4 becomes a subclass of both a2 and a3, the problem arises of how to merge the original components of a1 into a4.
Thanks
Santosh
‎2012 May 22 3:28 PM
ABAP doesn't support Multiple Inheritance from classes, but you can achieve the similar functionality using Interfaces. Check out ABAP Objects – Achieve Multiple Inheritance using Interfaces
Only thing you can't achieve using this workaround is the redefinition on the methods in the concrete class if you wish to use the default functionality.
Regards,
Naimesh Patel