我对这种编码水平还比较陌生,并且确实在遇到这种错误时遇到了麻烦:

[Line 65] error C2143: syntax error : missing ';' before '.'

显然,这通常意味着我的代码中出现语法错误,但是我找不到它在任何地方。任何帮助(或第二组眼睛看到我的错误将不胜感激)。

这是有问题的代码段:
class RacingCar {

public:
            Wheel* wheels[4];

            RacingCar()
            {
                wheels[0] = new Wheel;
                wheels[1] = new Wheel;
                wheels[2] = new Wheel;
                wheels[3] = new Wheel;
            }

            RacingCar( RacingCar& refOldCar)
            {
//              new Wheel(refOldCar.wheels[0]->pressure);
                wheels[0] = new Wheel;
                wheels[1] = new Wheel;
                wheels[2] = new Wheel;
                wheels[3] = new Wheel;

                int a = refOldCar.speedCopy();
                **RacingCar.setSpeed(10);**
                RacingCar.Brake(50);
                RacingCar.Print();
                RacingCar.speed = refOldCar.speed;
            }

非常感谢您的帮助

最佳答案

这个:

RacingCar.setSpeed(10);

应该:
setSpeed(10);

简写为:
this->setSpeed(10);

10-08 04:44