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