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; package hatelace;
public abstract class Word { public interface Word {
public abstract <T> T getValue(); <T> T getValue();
public abstract Word add(Word other); Word add(Word other);
public abstract Word subtract(Word other); Word subtract(Word other);
public abstract Word multiply(Word other); Word multiply(Word other);
public abstract Word divide(Word other); Word divide(Word other);
public abstract String toString(); String toString();
public abstract boolean equals(Object other); boolean equals(Object other);
} }

View file

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

View file

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