All pastes #735525 Raw Edit

Mine

public cpp v1 · immutable
·published 2007-10-13 18:16 UTC
rendered paste body
#include <iostream>using namespace std;class Point{public:    int x;    int y;    Point(int px = 0, int py = 0) : x(px), y(py) {};    ostream& operator<< (ostream& out);};ostream& Point::operator<< (ostream& out){  return out << "(" << x << ", " << y << ")";}/*class Rect : public Point, public Size{public:    Rect(s16 rx = -1, s16 ry = -1, u16 rw = 0, u16 rh = 0) : Point(rx, ry), Size(rw, rh){};    Rect(const Point & pt, u16 rw, u16 rh) : Point(pt), Size(rw, rh){};    Rect(const Point & pt, const Size & sz) : Point(pt), Size(sz){};    Rect(const std::vector<Rect> & vect);    const Size & size(void) const{ return *this; };    bool valid(void) const{ return !(x < 0 || y < 0 || w == 0 || h == 0); };    inline Rect & operator= (const Point & pt){ x = pt.x; y = pt.y; return *this; };    inline bool operator== (const Rect & rt) const{ return (x == rt.x && y == rt.y && w == rt.w && h == rt.h); };    inline bool operator!= (const Rect & rt) const{ return !(*this == rt); };    // rect include point    inline bool operator& (const Point & pt) const{ return !(pt.x < x || pt.y < y || pt.x >= (x + w) || pt.y >= (y + h)); };    // rect intersects rect    inline bool operator& (const Rect & rt) const{ return	(rt.x > x && rt.x < x + w ||	rt.x + rt.w > x && rt.x + rt.w < x + w ||	x > rt.x && x < rt.x + rt.w ||	x + w > rt.x && x + w < rt.x + rt.w) &&	(rt.y > y && rt.y < y + h ||	rt.y + rt.h > y && rt.y + rt.h < y + h ||	y > rt.y && y < rt.y + rt.h ||	y + h > rt.y && y + h < rt.y + rt.h); };};*/class quad{  private:    Point v1, v2, v3, v4;  public:    quad (const Point sv1, const Point sv2, const Point sv3,        const Point sv4): v1(sv1), v2(sv2), v3(sv3), v4(sv4) {};    ostream& operator<< (ostream& out);};ostream& quad::operator<< (ostream& out){  return out << "v1 = " << v1 << endl << "v2 = " << v2 << endl << "v3 = "    << v3 << endl << "v4 = " << v4;}int main(int argc, char** argv){  quad* q = new quad(Point(0,0), Point(1,0),      Point(1,1), Point(0,1));  cout << q;  return 0;}