
隐风shery
我不是很懂
>>
完整版
我不是很懂java,所以只能靠我对别的语言了解来帮你了。
main 前面一般不需要加上public/ private/ protect,所以只要void main(string[] args),而且它不嵌套进其他程序
感觉你这作业目标是写继承class,调用class
child class 里面包含error1 和error2 的method(删掉error1/2 前面的class) 里面也要改一下的感觉
class child{
public:
void error1(string[] args);
void error2(string[] args);
}
class parent: public child{
public:
void printerror(e){
//得到传入child里面的值,根据条件来改变输出结果
}
}
void main(){
child C = new child;
C.error1(string[]) = "考试不及格“; //思路这样,具体传值,参考书
C.error2(string[]) = "偷东西”;
}
基本这样,因为不会java,只能提供思路了