dev #62

Merged
KamaSK merged 20 commits from dev into main 2025-06-08 11:57:27 +03:00
2 changed files with 12 additions and 2 deletions
Showing only changes of commit 8399ab0d58 - Show all commits

View File

@ -0,0 +1,5 @@
package ru.kamask.pet.todo.model;
public interface Identifiable {
int getId();
}

View File

@ -1,6 +1,6 @@
package ru.kamask.pet.todo.model; package ru.kamask.pet.todo.model;
public abstract class Task { public abstract class Task implements Identifiable{
private static int nextId = 1; private static int nextId = 1;
protected int id; protected int id;
@ -11,10 +11,15 @@ public abstract class Task {
this.title = title; this.title = title;
} }
public int id() { @Override
public int getId() {
return id; return id;
} }
public int id() {
return getId();
}
@Override @Override
public String toString() { public String toString() {
return String.format("Задача: id - %d, title: \"%s\"", id, title); return String.format("Задача: id - %d, title: \"%s\"", id, title);