正在加载图片...
C++语言程序设计 例5-6使用友元函数计算两点距高 include <iostream> 友 include <cmath> using namespace std class point∥ Point类声明 元{ public:∥外部接口 Point( int xx=0, int yy=0)巛x=xx;Y≡yy;} int Getxo return X,] int GetYo return Y, friend float Distance(Point &a, Point &); private:∥私有数据成员 x int x.y:C++语言程序设计 37 例5-6 使用友元函数计算两点距离 #include <iostream> #include <cmath> using namespace std; class Point //Point类声明 { public: //外部接口 Point(int xx=0, int yy=0) {X=xx;Y=yy;} int GetX() {return X;} int GetY() {return Y;} friend float Distance(Point &a, Point &b); private: //私有数据成员 int X,Y; }; 友 元
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有