我想在公共类中调用一个无效函数,但我得到的错误我不明白:不能在公共类中调用函数...“新类型可能没有定义在返回类型中”
#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