Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Accessing Private class data

Former Member
0 Likes
1,472

Hi I have Created Class in SE24 and I have declared three public methods in that class and Finally I made Class as Private. then How can access the public methods of the class From the Report Program.

Regards,

D.Kiran Kumar.

4 REPLIES 4
Read only

Sandra_Rossi
Active Contributor
0 Likes
807

> I made Class as Private

hmmm. I guess you mean the flag which is located in the properties of the class. It means that you restrict the access to the class instanciation: it can only be instantiated by a method of the class itself, not from outside the class.

You can always access the public methods from everywhere. It's only the CREATE OBJECT (the instanciation) that you can't do outside the class.

Read only

Former Member
0 Likes
807

hi Kiran,

you can not access the public methods of the private class because you can not create the object of that private class......

Thanks and Regards

Gaurav Khare

Read only

matt
Active Contributor
0 Likes
807

>

> hi Kiran,

>

> you can not access the public methods of the private class because you can not create the object of that private class......

>

> Thanks and Regards

> Gaurav Khare

Not so. Consider a class my_class which is marked as private. Create a static public method, which returns r_myinstance TYPE REF TO my_class. The body of the static public method is

CREATE OBJECT r_myclass

. The static method is called a factory method. It can be used to implement the singleton pattern, and in other ways. There is extensive literature about this on the net.

matt

Read only

Former Member
0 Likes
807

This message was moderated.