新手求助!!!!
#include<iostream>using namespace std;
class point
{
public:
int x;
int y;
point(int xx,int yy):x(xx),y(yy)
{}
void show()
{
cout<<x<<" "<<y<<endl;
}
};
class my:public point
{
public:
my(int xx,int yy,int aa,int bb):x(xx),y(yy),a(aa),b(bb){}
void get()
{
cout<<a<<" "<<b<<endl;
}
private:
int a,b;
};
int main()
{
my m(1,2,3,4);
m.show();
m.get();
return 0;
}
--------------------Configuration: 10 - Win32 Debug--------------------
Compiling...
10.cpp
E:\C++6.0\Microsoft Visual Studio\MyProjects\10\10.cpp(20) : error C2512: 'point' : no appropriate default constructor available
E:\C++6.0\Microsoft Visual Studio\MyProjects\10\10.cpp(20) : error C2614: 'my' : illegal member initialization: 'y' is not a base or member
E:\C++6.0\Microsoft Visual Studio\MyProjects\10\10.cpp(20) : error C2614: 'my' : illegal member initialization: 'x' is not a base or member
执行 cl.exe 时出错.
10.obj - 1 error(s), 0 warning(s)