这些是我班级的属性:
class Addition_Struct: public Addition {
// attributes
struct a {
int element;
struct a *next;
};
struct b {
int element;
struct b *next;
};
struct outcome {
int element;
struct outcome *next;
};
struct a a_data;
struct b b_data;
struct outcome outcome_data;
// methods
a convertToStackA(int); // everything is right with this line
如何从 .cpp 文件中调用它们?使用this->a
语法返回“不允许类型名称”。使用a*
as 方法的返回值显示“不允许使用标识符”和“声明与...不兼容”。
.cpp 文件:
a* Addition_Struct::convertToStackA(int number)
{
// identifier "a" is undefined, and declaration is incompatible
}