Word abstract -> interface

This commit is contained in:
Imbus 2024-04-21 22:26:03 +02:00
parent 1bdb35a899
commit 422344097b
3 changed files with 10 additions and 10 deletions

View file

@ -1,11 +1,11 @@
package hatelace;
public abstract class Word {
public abstract <T> T getValue();
public abstract Word add(Word other);
public abstract Word subtract(Word other);
public abstract Word multiply(Word other);
public abstract Word divide(Word other);
public abstract String toString();
public abstract boolean equals(Object other);
public interface Word {
<T> T getValue();
Word add(Word other);
Word subtract(Word other);
Word multiply(Word other);
Word divide(Word other);
String toString();
boolean equals(Object other);
}

View file

@ -2,7 +2,7 @@ package hatelace.memtypes;
import hatelace.Word;
public class IntWord extends Word {
public class IntWord implements Word {
private Integer value;
public IntWord(Integer value) {

View file

@ -2,7 +2,7 @@ package hatelace.memtypes;
import hatelace.Word;
public class LongWord extends Word {
public class LongWord implements Word {
private Long value;
public LongWord(Long value) {