【发布时间】:2016-03-25 19:32:19
【问题描述】:
为什么"nota(sinais, subs, indices);" 行告诉函数不接受 3 个参数。我用 3 定义了一个构造函数。
class Solucao{
bool *sinal;
bool *sublinhado;
int *indice;
public:
Solucao(){sinal = sublinhado = NULL; indice = NULL; };
Solucao (bool *sinais, bool *subs, int *indices)
{
sinal = sinais;
sublinhado = subs;
indice = indices;
};
};
void Balas(int n, int m, Vector<float> c, Vector<float> b, Matrix<float> A) {
No_Balas *J = NULL;
Solucao *nota();
bool *sinais = new bool[1];
bool *subs = new bool[1];
int *indices = new int[1];
Vector<int> pto_inicial(1);
pto_inicial[0] = 0;
sinais[0] = 0;
subs[0] = 0;
indices[0] = 0;
nota(sinais, subs, indices);
}
【问题讨论】:
-
在您声明对象的行中似乎不正确。
-
这是一个指针,使用
new就像:nota = new Solucao(sinais, subs, indices);而不是nota(sinais, subs, indices);
标签: c++ class oop constructor