我有這個類:無效令牌「=」類,結構或接口成員聲明
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerGraphicsExercises
{
class Adamak
{
public int BodyX1;
public int BodyX2;
public int HeadX;
public int LeftArmX1;
public int LeftArmX2;
public int RightArmX1;
public int RightArmX2;
public int LeftLegX1;
public int LeftLegX2;
public int RightLegX1;
public int RightLegX2;
public int LeftEyeX;
public int RightEyeX;
public int PupilOfLeftEyeX;
public int PupilOfRightEyeX;
public int NoseX;
public int LipsX;
public int HairX;
public int LeftEarX;
public int RightEarX;
public int BodyY1;
public int BodyY2;
public int HeadY;
public int LeftArmY1;
public int LeftArmY2;
public int RightArmY1;
public int RightArmY2;
public int LeftLegY1;
public int LeftLegY2;
public int RightLegY1;
public int RightLegY2;
public int LeftEyeY;
public int RightEyeY;
public int PupilOfLeftEyeY;
public int PupilOfRightEyeY;
public int NoseY;
public int LipsY;
public int HairY;
public int LeftEarY;
public int RightEarY;
}
}
我宣佈這樣一個變量:
namespace ComputerGraphicsExercises
{
public partial class Main : Form
{
Adamak iMan2 = new Adamak();
}
}
現在我想改變價值:
iMan2.BodyX1 = 50;
,但我得到這個錯誤:
Error 1 Invalid token '=' in class, struct, or interface member declaration C:\vc\ComputerGraphicsExercises\ComputerGraphicsExercises\Main.cs 17 22 ComputerGraphicsExercises
我的錯誤是什麼?
http://stackoverflow.com/questions/3766660/need-help-with-this-error-invalid-token-in-class-struct-or-interface-mem – Hayden 2015-01-04 14:08:13
可能這[msdn]( http://msdn.microsoft.com/en-us/library/bb384062.aspx)幫助 – Grundy 2015-01-04 14:10:22