#ifndef _POINT_H
#define _POINT_H
class Point{
public:
Point();
Point(int x,int y);
~Point();
void move(int newx,int newy);
int getx() const {return x;};
int gety() const {return y;};
static void showcount();
private:
int x,y;
};
#endif
#include<iostream>
using namespace std;
Point::Point(){
x=y=0;
cout<<"default constructor called."<<endl;
}
Point::Point(int x,int y):x(x),y(y)
{cout<<"constructor called."<<endl;
}
Point::~Point(){
cout<<"destructor called."<<endl;
}
void Point::move(int newx,int newy)
{cout<<"moving the point to("<<newx<<","<<newy<<")"<<endl;
x=newx;
y=newy;}
#include<iostream>
using namespace std;
int main(){
cout<<"entering main...."<<endl;
Point a[2];
for(int i=0;i<2;i++)
a[i].move(i+10,i+20);
cout<<"exiting main...."<<endl;
return 0;}