[問題] 呼叫class函數與int
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux GCC
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
NO
問題(Question):
#include <cstdlib>
#include <iostream>
using namespace std;
int VDR = 3000;
void SetVR()
{
VDR =VDR -100;
APP->dec(5,4);
}
class APP
{
public:
void dec(int x, int y);
};
void dec(int x,int y)
{
int d = x-y;
cout << d << endl;
}
int main()
{
SetVR();
cout << VDR <<endl;
system("pause");
return 0;
}
預期的正確結果(Expected Output):
2900
1
錯誤結果(Wrong Output):
APP was not declared in this scope
不曉得如何處理?
我已經是使用public為何外部抓不到
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.117.164.19
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1425541584.A.C84.html
推
03/05 16:23, , 1F
03/05 16:23, 1F
→
03/05 21:31, , 2F
03/05 21:31, 2F
→
03/05 21:33, , 3F
03/05 21:33, 3F
推
03/05 21:35, , 4F
03/05 21:35, 4F
→
03/05 21:39, , 5F
03/05 21:39, 5F
→
03/05 21:40, , 6F
03/05 21:40, 6F
→
03/05 21:41, , 7F
03/05 21:41, 7F
→
03/05 21:42, , 8F
03/05 21:42, 8F