[3798] in java-interest

home help back first fref pref prev next nref lref last post

Re: Protected Is Default?

daemon@ATHENA.MIT.EDU (David Krohn)
Tue Nov 28 12:35:25 1995

Date: Tue, 28 Nov 95 09:05:00 CST
To: David.Geary@Central.Sun.COM (David Geary)
From: dkrohn@aristotle.ils.nwu.edu (David Krohn)
Cc: java-interest@java.Eng.Sun.COM

Actually,  I believe "friendly" is the default, which may mean that your
subclassed class would need to be in the same package as the original class.

I'm not positive though,

Dave Krohn
dkrohn@ils.nwu.edu
http://www.ils.nwu.edu/~dkrohn/

Institute for the Learning Sciences
Northwestern University

>I've got a class that extends Container:
>
>	package foo;
>
>	import java.awt.Container;
>
>	class A extends Container {
>		B b = null;
>	}
>
>When I compile:
>
>	trilby >> javac foo/A.java    
>	foo/A.java:5: No constructor matching Container() found in class java.awt.
Container.
>	class A extends Container {
>      	^
>	1 error
>
>Of course there is a Container():
>
>	// In Container.java:
>
>	Container() {
>	}
>
>If I change Container's default constructor access modifier to protected:
>
>	// In Container.java:
>
>	protected Container() {
>	}
>
>Then all is well:
>
>trilby >> javac foo/A.java
>trilby >>
>
>  What's the deal?  Is protected not the default access modifier? I'm using 
>the BETA release on Solaris 2.4, BTW.
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> David Geary                                  "I'm a bad man; I do what I can"
> geary@rmtc.Central.Sun.COM      
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>-
>This message was sent to the java-interest mailing list
>Info: send 'help' to java-interest-request@java.sun.com
>
>

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post