2013-04-20 65 views
0

有主文件(其中错误发生)是:不能调用成员函数没有对象

#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; 
} 

和错误:

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

为什么,即使我已经创建happenning的反对吗?

回答

2

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

a.delta(); 

你也不需要传递对象作为第一个参数,编译器会为你做。

相关问题