#include
using namespace std;
class Person
{
private:
char name[10];
char sex[5];
int age;
public:
Person(char a[],char b[],int c)
{
strcpy(name,a);
strcpy(sex,b);
age=c;
}
int x1(int a)
{
int x1;
x1=2018-a;
return x1;
}
void y1(int a)
{
cout<<a<<endl;
}
};
class Stu:public Person
{
int class1;
int num;
public:
Stu(char a1[],char b1[],int c1,int d1,int e1):Person(a1[],b1[],c1)
{
class1=d1;
num=e1;
}
};
int main()
{
Stu n1("s","boy",20,3,10)
n1.y1(n1.x1);
return 0;
}
Compiling...
1.cpp
E:\C++作业\1219\1.cpp(34) : error C2059: syntax error : ']'
E:\C++作业\1219\1.cpp(46) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
1.obj - 1 error(s), 0 warning(s)