這些都是我的類的屬性:結構在屬性
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*
作爲方法的返回值顯示「不允許標識符」,並且「聲明與...不兼容」。
.cpp文件:
a* Addition_Struct::convertToStackA(int number)
{
// identifier "a" is undefined, and declaration is incompatible
}
我更新了我的答案,以解決您的新信息。見下圖。 – StoryTeller