>>Are you sure, would you be able to see their existence using reflection?
Not sure about the reflection thing, but read below.
BTW - im a java newbie :)
I made some modifications to Pete's example, which i think proves the
existance of the private fields and methods in inherited classes.
Basically a method from SubTester is running a private method and displaying
a private field. This is done through a protected method, which is not
really practical, but it does prove that the private method/fields exists in
the the inherited subclass, you just cant directly access them just like
"Java in a Nutshell" states.
import java.io.*;
import java.util.*;
public class Tester {
private int myInt = 1;
public static void main(String args[]) throws Exception {
SubTester st = new SubTester();
st.doMethod();
}
private void testMethod(){
System.out.println("This is a private method returning a private var
" + myInt);
}
protected void method() {
System.out.println("Tester::method " + myInt);
testMethod();
}
}
class SubTester extends Tester {
public void doMethod() {
this.method();
}
protected void method() {
super.method();
System.out.println("SubTester::method");
}
}
-----Original Message-----
From: Matt Liotta [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 8:05 PM
To: CF-Talk
Subject: RE: I like CFMX
Are you sure, would you be able to see their existence using reflection?
-Matt
> -----Original Message-----
> From: Jeff Green [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 29, 2002 7:15 PM
> To: CF-Talk
> Subject: RE: I like CFMX
>
> > Page 107 : Access control and inheritance
>
> > "Private fields and methods are never inherited..."
>
> Continue reading and it says they are inherited just not accessable.
So
> they do exist in the class.
>
> jeff
>
> -----Original Message-----
> From: Mike Chambers [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 29, 2002 4:43 PM
> To: CF-Talk
> Subject: RE: I like CFMX
>
>
> hmm, thats odd.
>
> >From Java In A NutShell 3rd ed.(published by Oreilly)
>
> Page 106 : Access to members
>
> "If a member of a class is declared private, the member is never
> accessible except within the class itself."
>
> Page 107 : Access control and inheritance
>
> "Private fields and methods are never inherited..."
>
> we are talkig about the same thing aren't we?
>
> mike chambers
>
> [EMAIL PROTECTED]
>
> > -----Original Message-----
> > From: Matt Liotta [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, April 29, 2002 7:14 PM
> > To: CF-Talk
> > Subject: RE: I like CFMX
> >
> >
> > In Java, a subclass does in fact inherit private methods and
> > properties.
> >
> > -Matt
> >
> > > -----Original Message-----
> > > From: Mike Chambers [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, April 29, 2002 3:59 PM
> > > To: CF-Talk
> > > Subject: RE: I like CFMX
> > >
> > > matt,
> > >
> > > correct if i am wrong (my java is a little rusty), but when
> > inheriting
> > > from a class in java, the subclass does not inherit private
> > methods or
> > > properties from the superclass (only protected and public).
> > >
> > > mike chambers
> > >
> > > [EMAIL PROTECTED]
> > >
> > > > -----Original Message-----
> > > > From: Matt Liotta [mailto:[EMAIL PROTECTED]]
> > >
> > > > There are a lot of ways to argue this point. My point of view
> > > > is that MM
> > > > shouldn't tease us with OO type constructs. Either gives
> > > > everything J2EE
> > > > has to offer or don't bother at all.
> > > >
> > > > -Matt
> > >
> > >
> >
>
>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists