on 2012 May 09 1:02 PM
hi help me soon i need to create one private class in my application give me some example
Hi,
I am not sure what sort of example you want.
To create a private class the only thing you have to do is:
Go to SE24,
Create a class
And in the popup, select 'Private' in Instantiation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the private class say ( ZCL_TEST) , create a static method say CREATE_OBJECT. In this method create an object of type ref to ZCL_TEST and set it as an exporting parameter of the method.
Now in your program call this method like ZCL_TEST=>CREATE_OBJECT and you will get the reference object from this method.
Now you can call any instance methods of this class using this reference.
Hi,
One very simple scenario for creating a Private class is when you dont want that instances of the class can be created outside the class.
The creation of a Private class is generally used along with 'FINAL' to make the class as singleton. In this case, the class can be instantiated only once.
User | Count |
---|---|
63 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.