//============================================================================
// Name : class_point.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
class Point {
private :
double x,y,r;
public :
Point(double x,double y,double r);
~Point() {
x=y=r=0;
cout<<"ended sir";
}
double get_radius();
void operator ++();
void operator --();
};
Point::Point(double x,double y,double r) {
this->x = x;
this->y = y;
this->r = r;
}
double Point::get_radius() {
return this->r;
}
void Point::operator ++() {
x+=1;
y+=1;
r+=1;
}
void Point::operator --() {
x-=1;
y-=1;
r-=1;
}
int main() {
Point p(1,2,30);
cout<<p.get_radius();
++p;
++p;
cout<<p.get_radius();
return 0;
}
// Name : class_point.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
class Point {
private :
double x,y,r;
public :
Point(double x,double y,double r);
~Point() {
x=y=r=0;
cout<<"ended sir";
}
double get_radius();
void operator ++();
void operator --();
};
Point::Point(double x,double y,double r) {
this->x = x;
this->y = y;
this->r = r;
}
double Point::get_radius() {
return this->r;
}
void Point::operator ++() {
x+=1;
y+=1;
r+=1;
}
void Point::operator --() {
x-=1;
y-=1;
r-=1;
}
int main() {
Point p(1,2,30);
cout<<p.get_radius();
++p;
++p;
cout<<p.get_radius();
return 0;
}