我想在公共類中調用一個無效函數,但我得到的錯誤我不明白:不能在公共類中調用函數...「新類型可能沒有定義在返回類型中」
#include <iostream>
class Buttons
{
public:
Buttons()
{
short pushl;
short *tail;
cout << "Wally Weasel" << "/t";
void init_sub(int x, int y);
};
~Buttons()
{
cout << "Buttons has been destroyed!";
};
}
int main(int args, char**LOC[])
{
int z, a;
Buttons::init_sub(z, a);
return 2;
}
Buttons::void init_sub(int x, int y)
{
cout << &x << &y;
}
最新更新的代碼(仍然不能正常工作):
#include <iostream>
using namespace std;
class Buttons
{
public:
Buttons()
{
short pushl; // unused variable in Constructor: should be a member variable?
short *tail; // same
cout << "Wally Weasel" << "/t";
};
~Buttons()
{
cout << "Buttons has been destroyed!";
}
void init_sub(int z, int a);
};
int main(int args, char **LOC[])
{
int z = 0;
int a = 1;
Buttons::init_sub(z, a);
return 2;
}
void Buttons::init_sub(int x, int y)
{
cout << &x << " " << &y;
}
我爲什麼不能調用函數?
原件仍然出錯:
PS「的新類型可能無法在返回類型定義」:我更新了我的代碼以匹配我的情況的現狀 - 儘管仍相同的錯誤。 我一直在努力不懈地用C++ - 我習慣於低層次的編程,而沒有涉及語法/結構的很多語義。
代碼爲 – 2013-11-23 21:34:46
不清楚什麼不清楚呢? –
有一點點混亂,你想做什麼? – 2013-11-23 21:37:25