error C2504: 'Cperson' : base class undefined
#include<iostream>usingnamespacestd;classCPerson{public:char*Name;char*Number;char*Se...
#include<iostream>
using namespace std;
class CPerson
{
public:
char *Name;
char *Number;
char *Sex;
int Age;
setmessage(char *Name,char *Number,char *Sex,int Age);
showmessage();
};
class Student : public Cperson
{
private:
char *sname;
char *sno;
char *ssex;
int sage;
public: setmessage(char *sname,char *sno,char *ssex,int sage);
void showmessage()
{
//cout<<*sname<<'+'<<*sno<<'+'<<*ssex<<'+'<<sage<<endl;
cout<<*sname<<*sno<<*ssex<<sage<<endl;
}
};
void main()
{
Student s;
s.setmessage("小","941941941","妖",37);
s.showmessage();
}
报错
--------------------Configuration: test3 - Win32 Debug--------------------
Compiling...
test3.cpp
C:\C++\test3\test3.cpp(18) : error C2504: 'Cperson' : base class undefined
Error executing cl.exe.
test3.exe - 1 error(s), 0 warning(s) 展开
using namespace std;
class CPerson
{
public:
char *Name;
char *Number;
char *Sex;
int Age;
setmessage(char *Name,char *Number,char *Sex,int Age);
showmessage();
};
class Student : public Cperson
{
private:
char *sname;
char *sno;
char *ssex;
int sage;
public: setmessage(char *sname,char *sno,char *ssex,int sage);
void showmessage()
{
//cout<<*sname<<'+'<<*sno<<'+'<<*ssex<<'+'<<sage<<endl;
cout<<*sname<<*sno<<*ssex<<sage<<endl;
}
};
void main()
{
Student s;
s.setmessage("小","941941941","妖",37);
s.showmessage();
}
报错
--------------------Configuration: test3 - Win32 Debug--------------------
Compiling...
test3.cpp
C:\C++\test3\test3.cpp(18) : error C2504: 'Cperson' : base class undefined
Error executing cl.exe.
test3.exe - 1 error(s), 0 warning(s) 展开
2012-12-11 · 知道合伙人软件行家
关注
展开全部
#include<iostream>
using namespace std;
class CPerson
{
public:
char *Name;
char *Number;
char *Sex;
int Age;
setmessage(char *Name,char *Number,char *Sex,int Age){};
showmessage(){};
};
class Student : public CPerson
{
private:
char *sname;
char *sno;
char *ssex;
int sage;
public:
setmessage(char *sname,char *sno,char *ssex,int sage){};
void showmessage()
{
//cout<<*sname<<'+'<<*sno<<'+'<<*ssex<<'+'<<sage<<endl;
cout<<*sname<<*sno<<*ssex<<sage<<endl;
}
};
void main()
{
Student s;
s.setmessage("小","941941941","妖",37);
s.showmessage();
}
using namespace std;
class CPerson
{
public:
char *Name;
char *Number;
char *Sex;
int Age;
setmessage(char *Name,char *Number,char *Sex,int Age){};
showmessage(){};
};
class Student : public CPerson
{
private:
char *sname;
char *sno;
char *ssex;
int sage;
public:
setmessage(char *sname,char *sno,char *ssex,int sage){};
void showmessage()
{
//cout<<*sname<<'+'<<*sno<<'+'<<*ssex<<'+'<<sage<<endl;
cout<<*sname<<*sno<<*ssex<<sage<<endl;
}
};
void main()
{
Student s;
s.setmessage("小","941941941","妖",37);
s.showmessage();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询