|Home • Trainings • Quiz • Tips • Tutorials • Functional • Cert Q's • Interview Q's • Jobs • Testimonials • Advertise • Contact Us|
Visibility of Methods in Global Classes
By Anil Bharadwaj, OpenText Technologies
This is a very basic example in the OO
concepts in ABAP. In this example we deal with the visibility of classes and how
we can use them in our Custom Programs and how a constructor and Friend Function
work along with inheritance using Global Classes.
Create Global Class in Transaction
Select the type as Class
Make the class as Public
Here in the class I had created 4
methods with visibility as public, private, protected and a static method.
have 2 Levels options and 3 types Visibilities while creating Methods
method: For these methods we have to create object i.e. Instance while using
the class in the program. We can have any number of Instances of a class in a
method: For these we no need to create an object i.e. Instance, directly we
can use the method with the class name. this does not support polymorphism and
has many functionalities which are not needed at this stage.
These methods are accessible trough out the program with instances and for
subclasses and friends.
These Methods can be used only within the class where it is declared like the
other methods of the class and these methods cannot be used with object
reference from your Z Programs.
Below is the screen of the code of the
public method which is using the private and protected methods of its own class.
Now I had created another class which
inherits the above class. You can see the super class name.
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM
©2006-2007 SAPTechnical.COM. All rights reserved.
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG.
Graphic Design by Round the Bend Wizards