02-08-2008 7:32 AM
How to access the protected methos from a class..There is a built in class..For tht class i have created a object..
Built in class name : CL_GUI_TEXTEDIT
method : LIMIT_TEXT.
How to access this..help me with code
02-08-2008 7:42 AM
Hi,
All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. Protected components form a special interface between a class and its subclasses.
We can access the Protected components by inheriting the class.
<REMOVED BY MODERATOR>
Cheers,
Chandra Sekhar.
Edited by: Alvaro Tejada Galindo on Feb 19, 2008 2:22 PM
02-08-2008 7:37 AM
hi,
If inheritance is used properly, it provides a significantly better structure, as common components only
need to be stored once centrally (in the superclass) and are then automatically available to subclasses.
Subclasses also profit immediately from changes (although the changes can also render them invalid!).
Inheritance provides very strong links between the superclass and the subclass. The subclass must
possess detailed knowledge of the implementation of the superclass, particularly for redefinition, but also in
order to use inherited components.
Even if, technically, the superclass does not know its subclasses, the
subclass often makes additional requirements of the superclass, for example, because a subclass needs
certain protected components or because implementation details in the superclass need to be changed in
the subclass in order to redefine methods.
The basic reason is that the developer of a (super)class cannot
normally predict all the requirements that subclasses will later need to make of the superclass.
Inheritance provides an extension of the visibility concept: there are protected components. The visibility of
these components lies between that of the public components (visible to all users, all subclasses, and the class itself), and private (visible only to the class itself). Protected components are visible to and can be used by all subclasses and the class itself.
Subclasses cannot access the private components particularly attributes) of the superclass. Private
components are genuinely private. This is particularly important if a (super)class needs to make local
enhancements to handle errors: it can use private components to do this without knowing or invalidating
subclasses.
Create your class inse24 and inherit this CL_GUI_TEXTEDIT
class in yours. You can then access the protected methods.
Hope this is helpful, <REMOVED BY MODERATOR>
Edited by: Runal Singh on Feb 8, 2008 1:08 PM
Edited by: Alvaro Tejada Galindo on Feb 19, 2008 2:19 PM
02-08-2008 7:42 AM
Hi,
All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. Protected components form a special interface between a class and its subclasses.
We can access the Protected components by inheriting the class.
<REMOVED BY MODERATOR>
Cheers,
Chandra Sekhar.
Edited by: Alvaro Tejada Galindo on Feb 19, 2008 2:22 PM
02-08-2008 7:51 AM
If the programmer does not want that a certain method can be accessed he is setting the attribut protected to that method.
You can only use this method from inside the class.
There is no way to get access to that but do a modification on that class. Either you change the attribut or if you want to access that method from another metod you can set a friendship between both classes.
02-19-2008 2:03 PM