아래 코드에서이 오류가 발생하는 이유는 무엇입니까?이이 범위에서 선언되지 않았습니다. C++
class ST : public Instruction{
public:
ST (string _name, int _value):Instruction(_name,_value){}
void execute(int[]& anArr, int aVal){
//not implemented yet
cout << "im an st" <<endl;
anArr[value] = aVal;
}
virtual Instruction* Clone(){
return new ST(*this);
}
};
classes.h:81: error: ‘anArr’ was not declared in this scope
classes.h:81: error: ‘aVal’ was not declared in this scope
코드를 약간 수정하면 (즉,'Instruction'을 없애는 것), 같은 줄에 다른 오류가 생기고 그 문법이 생깁니다. 어떤 컴파일러를 사용하고 있습니까? – dirkgently
g ++로 컴파일하는 메신저 – user69514
@unknown : 그냥 classes.h에 위에 붙여 넣은 코드입니까? 그리고이 라인들 중 어느 라인이 81입니까? "void execute"가있는 줄입니까 – Aishwar