在下面程序横线处填上适当字句,完成类的定义。 class line; class box { public:
void set_color ( int c){ color=c; } void define_box ( int x1, int y1, int x2, int y2 ) { ux=x1; uy=y1; bx=x2; by=y2; } private: int color; int ux, uy; int bx, by; };
class line { public: friend int same_color( line a, box b); void set_color (int c) { color=c; } void define_line ( ) { startx=x1; starty=y1; endx=x2; endy=y2; } private: int color; int startx, starty; int endx, endy; }; int same_color( line a, box b) { if(a.color==b.color) return 1; return 0; }