求救:类外定义 函数指针
来源:百度知道 编辑:UC知道 时间:2024/05/14 03:05:44
#define STU struct s
class a {
STU{
int i;
};
STU Head;
public:
STU *find();
};
应该写成
STU *a::find(){ STU *p=Head; return p; }
还是
STU a::*find(){ STU *p=Head; return p; }
#include <iostream>
#define STU struct s
using namespace std;
class a {
STU{ int i; };
STU *Head;
public:
a(int t=1){ Head=new STU;Head->i=t; }
STU *find();
};
//STU *a::find(){ STU *p=Head; return p; }
STU a::*find(){ STU *p=Head;return p; }
int main () {
a a1;
cout<<a1.find()->i<<endl;
system("pause");
}
class a {
STU{
int i;
};
STU Head;
public:
STU *find();
};
应该写成
STU *a::find(){ STU *p=Head; return p; }
还是
STU a::*find(){ STU *p=Head; return p; }
#include <iostream>
#define STU struct s
using namespace std;
class a {
STU{ int i; };
STU *Head;
public:
a(int t=1){ Head=new STU;Head->i=t; }
STU *find();
};
//STU *a::find(){ STU *p=Head; return p; }
STU a::*find(){ STU *p=Head;return p; }
int main () {
a a1;
cout<<a1.find()->i<<endl;
system("pause");
}
STU *a::find(){ STU *p=Head; return p; }
求救:类外定义 函数指针
悬赏分:0 - 离问题结束还有 13 天 15 小时
#define STU struct s
class a {
STU{
int i;
};
STU Head;
public:
STU *find();
};
应该写成
STU *a::find(){ STU *p=Head; return p; }
还是
STU a::*find(){ STU *p=Head; return p; }
问题补充:#include <iostream>
#define STU struct s
using namespace std;
class a {
STU{ int i; };
STU *Head;
public:
a(int t=1){ Head=new STU;Head->i=t; }
STU *find();
};
//STU *a::find(){ STU *p=Head; return p; }
STU a::*find(){ STU *p=Head;return p; }
int main () {
a a1;
cout<<a1.find()->i<<endl;
system("pause");