问题
问答题
#include<iostream.h>
class Point
protected:
int x,y;
public:
Point(int i,int j)x=i,y=j;
void Showxy()cout<<"x="<<x<<",y="<<y<<endl;
~Point()cout<<"Delete Point"<<endl;
;
void main()
Point a;
答案
参考答案:Point a;Point类中有构造函数,系统不再自动产生无参构造函数。可以在声明对象的同时给定初始值,如Point a(0,0);。