include iostream include math using namespace std class Point public i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <iostream>
#include <math.h>
using namespace std;
class Point
{
public:
int x, y;
public:
Point(int x, int y)
{
cout << " Point"<<endl;
this->x=x;
this->y=y;
}
~Point()
{ cout << " ~Point"<<endl; }
bool raven(Point B)
{
if (this->x == B.x && this->y == B.y)
return true;
else
return false;
}
};
class Point3D: public Point
{
int z;
public:
Point3D(int x, int y, int z) : Point(x,y)
{
cout << " Point3D"<<endl;
this->z=z;
}
~Point3D() { cout << " ~Point3D"<<endl; }
double radius_vector()
{
return sqrt(x*x+y*y+z*z);
}
bool raven(Point3D B)
{
if (this->x == B.x && this->y == B.y && this->z == B.z)
return true;
else
return false;
}
} ;
int main()
{
Point B (3,4);
Point c (3,5);
Point3D A(3,4,0);
Point3D D(3,4,0);
cout<<A.raven(D)<<endl;
cout<<A.radius_vector()<<endl;
return 0;
}