ACCESSING PRIVATE METHOD OF A CLASS OF A CLASS FILE FROM ANOTHER CLASS FILE

Posted by ANU_DGR8 under ASP.NET on 5/27/2010 | Views : 1564 | Status : [Member] | Replies : 2
I HAVE A PRIVATE METHOD IN A CLASS OF A CLASS FILE.NOW I WANT TO ACCESS THIS METHOD IN ANOTHER CLASS FILE'S BUTTON_CLICK EVENT..CN SOMEBODY HELP ME???

Thanks and Regards,
Hoosha Boosha



Responses

Posted by: Raja on: 5/27/2010 [Member] Starter

Up
0
Down
This is not possible as Private method is accessible only inside the same class. This behavior is the programming language behavior and you can't change it.

If you want your method to accessible in other class file you will have to make that method as public/internal. Or you can declare a property into the class and internally call the method inside the getter block.



Regards,
Raja, USA

ANU_DGR8, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Er.deepakdalal on: 5/27/2010 [Member] Starter

Up
0
Down
I am totally agree here with Mr.Raja. These are some slandered rules designed or applied when the language is standardized for the security purpose and you can't change them.

ANU_DGR8, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response