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

How do I access?

Former Member
0 Likes
484

Hello,

Is there any way that i can access the methods of a class that are defined in its PRIVATE section.

Pointers for the same woudl be appreciated.

Thanks!!

Jai...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
467

Hi,

Private Methods of a class.. it cannot be called directly. It can only be called by the public methods of the class.

had your reqmt is possible, then the whole concept of encapsulation fails.

hope this helps.

Thanks

Balaji

3 REPLIES 3
Read only

Former Member
0 Likes
468

Hi,

Private Methods of a class.. it cannot be called directly. It can only be called by the public methods of the class.

had your reqmt is possible, then the whole concept of encapsulation fails.

hope this helps.

Thanks

Balaji

Read only

matt
Active Contributor
0 Likes
467

Look for public methods, typically named "GET_attribute" or "SET_attribute" (getters and setters), that provide the values of private attributes. Sometimes you might find a method that returns the attribute you're interested in, in a structure, or another object.

However, if the programmer of the class hasn't provided access in such a way, you can't get at the data.

matt

Read only

Former Member
0 Likes
467

hi,

Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.

so, the methods that are declared in the private section cannot be accesed.

rewards if usefull.