Skip to content

Conversation

@KritoSV
Copy link

@KritoSV KritoSV commented May 19, 2024

Предполагал сделать отдельно создание человек, отдельно создание семьи. А после образования семьи уже создание древа семьи, но что-то пошло не так.
Прошу помощи.

import java.util.ArrayList;
import java.util.List;

public class Family extends Human{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Семья и человек это очевидно не одно и тоже. Наследование ошибочно. Например у Семьи нет пола или возраста, а у человека есть

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Возможно неудачно выбрано имя класса

Comment on lines +9 to +10
private Human father, mother;
private List<Human> parents;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не понял. Отдельно папа и мама и отдельно список родителей? Это не одно и тоже?


public Human(String name, Gender gender, LocalDate birthDate) {
id = -1;
this.name = name.toString();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем toString? name и так является стрингом

import java.time.LocalDate;

public class Main {
public static void main(String[] args) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не показано создание родственных связей

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants