【发布时间】:2011-02-22 01:39:31
【问题描述】:
我正在尝试为班级创建一个基于文本的游戏,但我一直在试图让我的主要班级 GCPUAPP 从我的 Artifact 班级中读取数据。
这是我为 GCPUAPP 类输入的代码:
Artifact artifact=new Artifact();
artifact.name="Harry Potter and the Deathly Hallows";
artifact.description="Harry and his friends save the qizarding world again";
r1.contents=artifact;
dialog();
它在“新工件”上给我一个错误。这是我在 Artifact 上的代码:
public abstract class Artifact{
String name, description;
public String toString(){
return name;
}
我是 Java 新手,所以我完全被卡住了。
【问题讨论】:
标签: java class inheritance text adventure