2007 Oct 26 7:10 AM
How can we differ two methods irrespective of the method names.That means suppose in a class there are two methods with same names but with different parameters which are of differernt data types then the 2 methods will be different or they will be same and exhibiting the phenomenon of polymorphism.
2007 Oct 26 9:59 AM
Dear Sandeep,
In ABAP, method name are unique i.e., we can not have 2 methods with same name but with different arguments. It is possible other OO language like C++ but not in ABAP.
Using inheritance we can have same method name of base class but here we have to redefine in sub class using REDEFINITION.
Regards
Kesava
2007 Oct 26 9:59 AM
Dear Sandeep,
In ABAP, method name are unique i.e., we can not have 2 methods with same name but with different arguments. It is possible other OO language like C++ but not in ABAP.
Using inheritance we can have same method name of base class but here we have to redefine in sub class using REDEFINITION.
Regards
Kesava
2007 Oct 26 10:53 AM
Hi Sandeep,
This question actually answers your first question as well.
We can not have methods with same name in a class in ABAP. I mean there is no method overloading in ABAP. Then you may ask me how polymorphism is possible ??. You can redefine a method in inherited classes. I mean method overriding. Now one method is existing with the same name but with 2 different implementations. Hence its poly morphism. Now once again the question is which implementation will be called ?? It depends upon the object which is calling the method. Depending the object which is calling the method implementation is called. <b>So Poly morphism in ABAP is achieved through method over riding.</b>
I have seen your different questions. Great .. Keep going in OOABAP. Its sexy.
If i find time i'll give you code samples as well.
Reward points if useful,
Aleem.
2007 Oct 26 11:26 AM
Hi Sandeep,
the only answer i can say to your question is in ABAP.
we dont have 2 methods with the same name in a single class.
however this is possible when we inherit the class->another class and write Redefinition for that method.
first checking will be done with method names only.
After that only parameters come into picture when we execute the method.
if you want more clerification.
so that i can answer you.
WITH REGARDS,
Lokesh@eds