记录详情

Compile Error

/in/foo.cc: In function 'Vector3 operator*(const Vector3&, const Matrix3&)':
/in/foo.cc:92:34: error: 'int Matrix3::v [3][3]' is private within this context
   92 |     int newX = vector.x * matrix.v[0][0] + vector.y * matrix.v[0][1] + vector.z * matrix.v[0][2];
      |                                  ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc:92:62: error: 'int Matrix3::v [3][3]' is private within this context
   92 |     int newX = vector.x * matrix.v[0][0] + vector.y * matrix.v[0][1] + vector.z * matrix.v[0][2];
      |                                                              ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc:92:90: error: 'int Matrix3::v [3][3]' is private within this context
   92 |     int newX = vector.x * matrix.v[0][0] + vector.y * matrix.v[0][1] + vector.z * matrix.v[0][2];
      |                                                                                          ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc:93:34: error: 'int Matrix3::v [3][3]' is private within this context
   93 |     int newY = vector.x * matrix.v[1][0] + vector.y * matrix.v[1][1] + vector.z * matrix.v[1][2];
      |                                  ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc:93:62: error: 'int Matrix3::v [3][3]' is private within this context
   93 |     int newY = vector.x * matrix.v[1][0] + vector.y * matrix.v[1][1] + vector.z * matrix.v[1][2];
      |                                                              ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc:93:90: error: 'int Matrix3::v [3][3]' is private within this context
   93 |     int newY = vector.x * matrix.v[1][0] + vector.y * matrix.v[1][1] + vector.z * matrix.v[1][2];
      |                                                                                          ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc:94:34: error: 'int Matrix3::v [3][3]' is private within this context
   94 |     int newZ = vector.x * matrix.v[2][0] + vector.y * matrix.v[2][1] + vector.z * matrix.v[2][2];
      |                                  ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc:94:62: error: 'int Matrix3::v [3][3]' is private within this context
   94 |     int newZ = vector.x * matrix.v[2][0] + vector.y * matrix.v[2][1] + vector.z * matrix.v[2][2];
      |                                                              ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc:94:90: error: 'int Matrix3::v [3][3]' is private within this context
   94 |     int newZ = vector.x * matrix.v[2][0] + vector.y * matrix.v[2][1] + vector.z * matrix.v[2][2];
      |                                                                                          ^
/in/foo.cc:39:9: note: declared private here
   39 |     int v[3][3];
      |         ^
/in/foo.cc: In function 'Vector3 operator*(const Matrix3&, const Vector3&)':
/in/foo.cc:100:40: error: 'int Vector3::x' is private within this context
  100 |     int newX = matrix.v[0][0] * vector.x + matrix.v[0][1] * vector.y + matrix.v[0][2] * vector.z;
      |                                        ^
/in/foo.cc:10:9: note: declared private here
   10 |     int x, y, z;
      |         ^
/in/foo.cc:100:68: error: 'int Vector3::y' is private within this context
  100 |     int newX = matrix.v[0][0] * vector.x + matrix.v[0][1] * vector.y + matrix.v[0][2] * vector.z;
      |                                                                    ^
/in/foo.cc:10:12: note: declared private here
   10 |     int x, y, z;
      |            ^
/in/foo.cc:100:96: error: 'int Vector3::z' is private within this context
  100 |     int newX = matrix.v[0][0] * vector.x + matrix.v[0][1] * vector.y + matrix.v[0][2] * vector.z;
      |                                                                                                ^
/in/foo.cc:10:15: note: declared private here
   10 |     int x, y, z;
      |               ^
/in/foo.cc:101:40: error: 'int Vector3::x' is private within this context
  101 |     int newY = matrix.v[1][0] * vector.x + matrix.v[1][1] * vector.y + matrix.v[1][2] * vector.z;
      |                                        ^
/in/foo.cc:10:9: note: declared private here
   10 |     int x, y, z;
      |         ^
/in/foo.cc:101:68: error: 'int Vector3::y' is private within this context
  101 |     int newY = matrix.v[1][0] * vector.x + matrix.v[1][1] * vector.y + matrix.v[1][2] * vector.z;
      |                                                                    ^
/in/foo.cc:10:12: note: declared private here
   10 |     int x, y, z;
      |            ^
/in/foo.cc:101:96: error: 'int Vector3::z' is private within this context
  101 |     int newY = matrix.v[1][0] * vector.x + matrix.v[1][1] * vector.y + matrix.v[1][2] * vector.z;
      |                                                                                                ^
/in/foo.cc:10:15: note: declared private here
   10 |     int x, y, z;
      |               ^
/in/foo.cc:102:40: error: 'int Vector3::x' is private within this context
  102 |     int newZ = matrix.v[2][0] * vector.x + matrix.v[2][1] * vector.y + matrix.v[2][2] * vector.z;
      |                                        ^
/in/foo.cc:10:9: note: declared private here
   10 |     int x, y, z;
      |         ^
/in/foo.cc:102:68: error: 'int Vector3::y' is private within this context
  102 |     int newZ = matrix.v[2][0] * vector.x + matrix.v[2][1] * vector.y + matrix.v[2][2] * vector.z;
      |                                                                    ^
/in/foo.cc:10:12: note: declared private here
   10 |     int x, y, z;
      |            ^
/in/foo.cc:102:96: error: 'int Vector3::z' is private within this context
  102 |     int newZ = matrix.v[2][0] * vector.x + matrix.v[2][1] * vector.y + matrix.v[2][2] * vector.z;
      |                                                                                                ^
/in/foo.cc:10:15: note: declared private here
   10 |     int x, y, z;
      |               ^

信息

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