I try to create a constructor in my extended class in order to create objects in my main class. When i generate the default eclipse constructor, it shows all the fields of my superclass and when I try to create the object in my main, I need to put all the fields.
Here is my Person class:
public class Person {
private String id;
private String name;
private String gender;
private String country;
private String cities;
private String birthDate;
private String deathDate;
private List<String> aliases = new ArrayList<String>();
private List<String> tags = new ArrayList<String>();
public Person(String id, String name, String gender, String country, String cities, String birthDate,
String deathDate, List<String> aliases, List<String> tags) {
this.id = id;
this.name = name;
this.gender = gender;
this.country = country;
this.cities = cities;
this.birthDate = birthDate;
this.deathDate = deathDate;
this.aliases = aliases;
this.tags = tags;
}
And here is my extended one, the group class:
public class Group extends Person{
private String name;
private String country;
private String cities;
private String beginDate;
private String endDate;
private List<String> aliases = new ArrayList<String>();
private List<String> tags = new ArrayList<String>();
private List<Person> members = new ArrayList<Person>();
public Group(String id, String name, String gender, String country, String cities, String birthDate,
String deathDate, List<String> aliases, List<String> tags, String name2, String country2, String cities2,
String beginDate, String endDate, List<String> aliases2, List<String> tags2, List<Person> members) {
super(id, name, gender, country, cities, birthDate, deathDate, aliases, tags);
name = name2;
country = country2;
cities = cities2;
this.beginDate = beginDate;
this.endDate = endDate;
aliases = aliases2;
tags = tags2;
this.members = members;
}
This is the constructor that gets generated (the huge one) When I try to create object on my main it requires all the fields (even the Person's class fields) So is there any way to create Group objects by filling the fields of my Group class only? Thanks in advance.