Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Help > access levels f...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 11 Topic 15966 of 16477
Post > Topic >>

access levels for private field which is inherited

by thufir <hawat.thufir@[EMAIL PROTECTED] > Apr 13, 2008 at 10:01 AM

I want to pass in "name" in the Student class constructor, but cannot 
because "name" is a private field in the Person class which Student 
extends; Person and Student are in the same package.

Additional fields are declared in Student which aren't in the Person 
class.

I'm reviewing access levels, but don't see how this can be done.

Would someone provide an example where Foo extends Bar and there are 
private fields in Bar which Foo uses in its constructor(s)?  Seems a 
conundrum...Using the following example:


package attribs;

public class Foo extends Bar {

  private String id;

  public Foo(String name,String id){
    this.name = name;
    this.id = id
  }
}



package attribs;

public class Bar {

  private String name;

  public setName(String name) {this.name = name;}
}





thanks,

Thufir
 




 11 Posts in Topic:
access levels for private field which is inherited
thufir <hawat.thufir@[  2008-04-13 10:01:29 
Re: access levels for private field which is inherited
Lothar Kimmeringer <ne  2008-04-13 12:38:52 
Re: access levels for private field which is inherited
Lew <lew@[EMAIL PROTEC  2008-04-13 07:41:05 
Re: access levels for private field which is inherited
Mark Space <markspace@  2008-04-13 09:37:03 
Re: access levels for private field which is inherited
"Larry A Barowski&qu  2008-04-13 17:16:24 
Re: access levels for private field which is inherited
Mark Space <markspace@  2008-04-15 17:09:33 
Re: access levels for private field which is inherited
Roedy Green <see_websi  2008-04-14 21:12:11 
Re: access levels for private field which is inherited
Roedy Green <see_websi  2008-04-14 20:56:51 
Re: access levels for private field which is inherited
thufir <hawat.thufir@[  2008-04-15 10:21:27 
Re: access levels for private field which is inherited
thufir <hawat.thufir@[  2008-04-15 23:06:17 
Re: access levels for private field which is inherited
Chase Preuninger <chas  2008-04-15 16:46:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 12:35:21 CDT 2008.