@@ -64,34 +64,39 @@ class Point
6464
6565std::ostream& operator <<(std::ostream& os, const Point& pIn);
6666
67- class Point3D : public Point
67+ class Point3D
6868{
6969 public:
7070 Point3D () = default ;
71- Point3D (int x, int y, int z) : Point(x, y), z_(z) {}
71+ Point3D (int x, int y, int z) : x_(x), y_( y), z_(z) {}
7272 Point3D& operator =(const Point3D&) = default ;
73- Point3D (const Point3D& p) : Point (p.getX(), p.getY ()), z_(p.getZ ()) {}
74- Point3D (const Point& p, int z) : Point(p ), z_(z) {}
73+ Point3D (const Point3D& p) : x_ (p.x()), y_(p.y ()), z_(p.z ()) {}
74+ Point3D (const Point& p, int z) : x_(p.x()), y_(p.y() ), z_(z) {}
7575
7676 bool operator ==(const Point3D& rhs) const ;
7777 bool operator !=(const Point3D& rhs) const { return !(*this == rhs); }
7878 bool operator <(const Point3D& rhs) const ;
7979 bool operator >=(const Point3D& rhs) const { return !(*this < rhs); }
8080
81- int z () const { return getZ (); }
82- int getZ () const { return z_; }
81+ int z () const { return z_; }
8382 void setZ (int z) { z_ = z; }
83+ int x () const { return x_; }
84+ void setX (int x) { x_ = x; }
85+ int y () const { return y_; }
86+ void setY (int y) { y_ = y; }
8487 void set (const int x, const int y, const int z)
8588 {
8689 setX (x);
8790 setY (y);
88- z_ = z ;
91+ setZ (z) ;
8992 }
9093
9194 friend dbIStream& operator >>(dbIStream& stream, Point3D& p);
9295 friend dbOStream& operator <<(dbOStream& stream, const Point3D& p);
9396
9497 private:
98+ int x_ = 0 ;
99+ int y_ = 0 ;
95100 int z_ = 0 ;
96101};
97102
0 commit comments