㈠ 浣跨敤緇ф壙鐨勬柟娉曠紪鍐欎竴涓綾伙紝媧劇敓涓涓綰挎碉紝婕旂ず鏋勯犲嚱鏁
浣跨敤緇ф壙鐨勬柟娉曪紝緙栧啓涓涓綾籔oint錛岀劧鍚庣敱瀹冩淳鐢熶竴涓綰挎電被Line錛屾紨紺烘瀯閫犲嚱鏁幫紝鎷瘋礉鏋勯犲嚱鏁幫紝鏋愭瀯鍑芥暟鍙婅皟鐢ㄩ『搴忋 1.3.2 璁捐¤佹眰 錛1錛塒oint鍙鑳芥湁涓涓鏋勯犲嚱鏁幫紝鑰屼笖璁句釜鏋勯犲嚱鏁板彧鑳藉叿鏈変袱涓鍙傛暟 錛2錛夋祴璇曠▼搴忓備笅錛 void main錛堬級 { Point a錛 Point b錛7.8錛7.9錛夛紝c錛34.5錛67.8錛夛紱 a = c錛 cout銆堛堚滀袱鐐逛箣闂寸殑璺濈諱負錛氣濄堛坅.Diatance(b)<<endl; Line s(7.8,7.9,34.5,67.8); Line s1(s); Cout<<s1.Display(s1)<<endl;} (3) Line綾葷殑澹版槑濡備笅錛 class Line : public Point { Public: Line(double x1, double y1, double x2, double y2);Line (Line &line); double Display(Line &line); ~Line(); double x ,y ; } (4) Point綾繪湁鏁板勬暟鎹鎴愬憳鐨勫嚱鏁癉isplay()錛屽叾鍘熷瀷涓 void Display(void)(5) Point綾繪湁鏁板勪袱鐐硅窛紱葷殑鍑芥暟Distance()(6) 緇欏嚭Line綾葷殑瀹炵幇騫惰捐℃弧瓚崇被瑕佹眰鐨凱oint綾(7) 鍒嗘瀽杈撳嚭鐨勭粨鏋滐紝鎬葷粨鏋勯犲嚱鏁板拰鏋愭瀯鍑芥暟鐨勮皟鐢ㄩ『搴 鎴戠敤鐨勭紪璇戠幆澧冩槸VisualC++6.0