<p>How to access a class which has private access </p>
1 posts in topic
Flat View  Flat View

Posted By:   PhiDi_TranThi
Posted On:   Thursday, August 1, 2002 01:44 PM

I wrote a java class, retCallInfo, which extends a super class, VoiceElementData. I tried to inherit some data types and methods from that supper class. But it generates the error messages as below:

"VoiceElementData() has private access in com.audium.server.VoiceElementData

public class retCallInfo extends VoiceElementData{

1 error"

How can I access the data and method in this private access supper class

Thanks in advance for any helps

PhiDi TranThi

Re: <p>How to access a class which has private access </p>

Posted By:   dmitriy_r  
Posted On:   Thursday, August 1, 2002 03:05 PM

You can't do it directly, however I would recommend some approaches:
1. inherit you class and copy parent class implementation. In this case you loose advantages of inheritance, but can change behavior of the class
2. Use delegate approach with reflection to access private members of delegate class (ex parent).

Also check comp.lang.java.programmer archives where this topic many times discussed.
About | Sitemap | Contact