在程序中我有类Player,Animation。
Animation & Animation::operator=(Animation & anim)
{
if (this != &anim)
{
//here other poles is assignmented
//like this: this->pole2 = anim.pole2;
...
anim.pole1 = 0;
return *this;
}
}
分配时我需要将其中一个字段清零。像这样: currentAnimation = anim1; anim1应该为零,例如,pole1。 我以这种方式重载了Animation类中的赋值运算符:
public Result run(String suite) {
Class<?> suiteClass = null;
try {
suiteClass = Class.forName(suite);
} catch (ClassNotFoundException ex) {
return null;
}
JUnitCore core = new JUnitCore();
this.testRun = new TestRun(testLogging, suite);
core.addListener(new TestRunListener(testLogging, testRun));
Result result = core.run(suiteClass);
return(result);
}
一切正常,但极点1不为零