0

There's the main file (where the error is occurring):

#include "classe_Segundo.h"
#include <iostream>

using namespace std;

CSegundo a;

int main (){

cout << "Equacao de Segundo Grau\n\n";
cin >> a;
CSegundo::delta(a);


return 0;   
}

And the error:

Line 12: Cannot call member function `void CSegundo::delta(CSegundo)' without object

Why is that happenning even if I've created the object up there?

4

1 回答 1

2

尝试调用它CSegundo::delta()需要将delta其声明为静态成员函数。你需要这样称呼它:

a.delta();

您也不需要将对象作为第一个参数传递,编译器会为您执行此操作。

于 2013-04-20T19:58:59.780 回答