‎2008 Aug 18 12:40 PM
‎2008 Aug 18 12:46 PM
Hi,
You can call a protected method in a class if the class is a subclass of that super class.
for that use inheritance.
class super_class definition.
protected section.
methods protected_method.
endclass.
class super_class implementation.
method protected_method.
...............
...............
end method.
endclass.
Class sub_class inheriting from super_class.
endclass.
Class sub_class implementation.
method protected_method. " If you are redefining
............
...........
end method.
endclass.
start-of-selection.
data: ref_sub type ref to sub_class. " referenec variable
create object ref_sub. "creating instance or object
call method ref_sub->protected_method. " calling the protected methodlike that
check out this link-
http://www.sapbrainsonline.com/ARTICLES/TECHNICAL/OBJECTS/objects.html
Regards,
Sujit
‎2008 Aug 18 12:46 PM
Hi,
You can call a protected method in a class if the class is a subclass of that super class.
for that use inheritance.
class super_class definition.
protected section.
methods protected_method.
endclass.
class super_class implementation.
method protected_method.
...............
...............
end method.
endclass.
Class sub_class inheriting from super_class.
endclass.
Class sub_class implementation.
method protected_method. " If you are redefining
............
...........
end method.
endclass.
start-of-selection.
data: ref_sub type ref to sub_class. " referenec variable
create object ref_sub. "creating instance or object
call method ref_sub->protected_method. " calling the protected methodlike that
check out this link-
http://www.sapbrainsonline.com/ARTICLES/TECHNICAL/OBJECTS/objects.html
Regards,
Sujit
‎2008 Aug 18 12:49 PM
Hi
create the instance for the subclass then you can call that method.
Regards
Manjari.
‎2008 Aug 18 1:00 PM
Hi,
Create the subclass to the class from which the protected method should be invoked. Then use that subclass and call that protected method.