记录详情

Compile Error

/in/foo.cc: In function 'Vector3 operator*(const Vector3&, const Matrix3&)':
/in/foo.cc:66:30: error: 'int Matrix3::v [3][3]' is private within this context
   66 |     int newX=vector.x*matrix.v[0][0]+vector.y*matrix.v[0][1]+vector.z*matrix.v[0][2];
      |                              ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc:66:54: error: 'int Matrix3::v [3][3]' is private within this context
   66 |     int newX=vector.x*matrix.v[0][0]+vector.y*matrix.v[0][1]+vector.z*matrix.v[0][2];
      |                                                      ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc:66:78: error: 'int Matrix3::v [3][3]' is private within this context
   66 |     int newX=vector.x*matrix.v[0][0]+vector.y*matrix.v[0][1]+vector.z*matrix.v[0][2];
      |                                                                              ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc:67:30: error: 'int Matrix3::v [3][3]' is private within this context
   67 |     int newY=vector.x*matrix.v[1][0]+vector.y*matrix.v[1][1]+vector.z*matrix.v[1][2];
      |                              ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc:67:54: error: 'int Matrix3::v [3][3]' is private within this context
   67 |     int newY=vector.x*matrix.v[1][0]+vector.y*matrix.v[1][1]+vector.z*matrix.v[1][2];
      |                                                      ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc:67:78: error: 'int Matrix3::v [3][3]' is private within this context
   67 |     int newY=vector.x*matrix.v[1][0]+vector.y*matrix.v[1][1]+vector.z*matrix.v[1][2];
      |                                                                              ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc:68:30: error: 'int Matrix3::v [3][3]' is private within this context
   68 |     int newZ=vector.x*matrix.v[2][0]+vector.y*matrix.v[2][1]+vector.z*matrix.v[2][2];
      |                              ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc:68:54: error: 'int Matrix3::v [3][3]' is private within this context
   68 |     int newZ=vector.x*matrix.v[2][0]+vector.y*matrix.v[2][1]+vector.z*matrix.v[2][2];
      |                                                      ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc:68:78: error: 'int Matrix3::v [3][3]' is private within this context
   68 |     int newZ=vector.x*matrix.v[2][0]+vector.y*matrix.v[2][1]+vector.z*matrix.v[2][2];
      |                                                                              ^
/in/foo.cc:24:9: note: declared private here
   24 |     int v[3][3];
      |         ^
/in/foo.cc: In function 'Vector3 operator*(const Matrix3&, const Vector3&)':
/in/foo.cc:72:36: error: 'int Vector3::x' is private within this context
   72 |     int newX=matrix.v[0][0]*vector.x+matrix.v[0][1]*vector.y+matrix.v[0][2]*vector.z;
      |                                    ^
/in/foo.cc:6:9: note: declared private here
    6 |     int x,y,z;
      |         ^
/in/foo.cc:72:60: error: 'int Vector3::y' is private within this context
   72 |     int newX=matrix.v[0][0]*vector.x+matrix.v[0][1]*vector.y+matrix.v[0][2]*vector.z;
      |                                                            ^
/in/foo.cc:6:11: note: declared private here
    6 |     int x,y,z;
      |           ^
/in/foo.cc:72:84: error: 'int Vector3::z' is private within this context
   72 |     int newX=matrix.v[0][0]*vector.x+matrix.v[0][1]*vector.y+matrix.v[0][2]*vector.z;
      |                                                                                    ^
/in/foo.cc:6:13: note: declared private here
    6 |     int x,y,z;
      |             ^
/in/foo.cc:73:36: error: 'int Vector3::x' is private within this context
   73 |     int newY=matrix.v[1][0]*vector.x+matrix.v[1][1]*vector.y+matrix.v[1][2]*vector.z;
      |                                    ^
/in/foo.cc:6:9: note: declared private here
    6 |     int x,y,z;
      |         ^
/in/foo.cc:73:60: error: 'int Vector3::y' is private within this context
   73 |     int newY=matrix.v[1][0]*vector.x+matrix.v[1][1]*vector.y+matrix.v[1][2]*vector.z;
      |                                                            ^
/in/foo.cc:6:11: note: declared private here
    6 |     int x,y,z;
      |           ^
/in/foo.cc:73:84: error: 'int Vector3::z' is private within this context
   73 |     int newY=matrix.v[1][0]*vector.x+matrix.v[1][1]*vector.y+matrix.v[1][2]*vector.z;
      |                                                                                    ^
/in/foo.cc:6:13: note: declared private here
    6 |     int x,y,z;
      |             ^
/in/foo.cc:74:36: error: 'int Vector3::x' is private within this context
   74 |     int newZ=matrix.v[2][0]*vector.x+matrix.v[2][1]*vector.y+matrix.v[2][2]*vector.z;
      |                                    ^
/in/foo.cc:6:9: note: declared private here
    6 |     int x,y,z;
      |         ^
/in/foo.cc:74:60: error: 'int Vector3::y' is private within this context
   74 |     int newZ=matrix.v[2][0]*vector.x+matrix.v[2][1]*vector.y+matrix.v[2][2]*vector.z;
      |                                                            ^
/in/foo.cc:6:11: note: declared private here
    6 |     int x,y,z;
      |           ^
/in/foo.cc:74:84: error: 'int Vector3::z' is private within this context
   74 |     int newZ=matrix.v[2][0]*vector.x+matrix.v[2][1]*vector.y+matrix.v[2][2]*vector.z;
      |                                                                                    ^
/in/foo.cc:6:13: note: declared private here
    6 |     int x,y,z;
      |             ^

信息

递交者
类型
自测
题目
P1020 OO4-4 矩阵类与向量类的算术运算符重载
语言
C++
递交时间
2025-03-29 20:58:49
评测时间
2025-03-29 20:58:49
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes