码迷,mamicode.com
首页 >  
搜索关键字:friend    ( 1299个结果
c++重载ostream的实现
#include using namespace std; class Point{ public: Point(int _x = 0, int _y = 0, int _z = 0):x(_x), y(_y), z(_z){} Point(){} ~Point(){} friend ostream& operator<<(ostream &os, const Point &pd); ...
分类:编程语言   时间:2014-09-19 04:29:05    阅读次数:183
poj2449 Remmarguts' Date,第K短路
点击打开链接 SPFA  + A* #include #include #include #include using namespace std; struct node { int v, dis, f, next; friend bool operator b.f; } }; const in...
分类:其他好文   时间:2014-09-16 23:44:21    阅读次数:189
二叉树 - 最大左高树
MaxHBLT.h #include template inline void Swap(T& a, T& b) { T c = a; a = b; b = c; } template class MaxHBLT; template class TNode { friend MaxHBLT; public: TNode(const T& val) { data =...
分类:其他好文   时间:2014-09-13 21:32:36    阅读次数:239
关于“为什么不加friend就会提示参数过多”
1 #include 2 using namespace std; 3 4 class Complex 5 { 6 double real, imag; 7 public: 8 Complex(double r, double i) :real(r), imag(i){} 9 ...
分类:其他好文   时间:2014-09-06 22:26:23    阅读次数:310
string类的实现
mystring.h #ifndef _MYSTRING_H_ #define _MYSTRING_H_ #include #include class mystring { friend std::ostream &operator<...
分类:其他好文   时间:2014-09-06 09:49:13    阅读次数:214
C++中的友元的体会
友元:假设A中声明了B是我的朋友,则在B内就可以使用了我(A)的一切数据,包括private类型数据。 友元的出现破坏了类的封装和隐藏性。   C++中的友元分为:友元函数和友元类 1. 友元函数: 在类中声明,在类外定义: class A { public: A(int i):m_i(i){} private:        friend void print(Aa); ...
分类:编程语言   时间:2014-09-05 14:25:01    阅读次数:164
第三方
#include #include #include #include using namespace std;typedef struct node{ int x,y,ans,num,pre; friend bool operatorb.ans; }} st;st qq[1000...
分类:其他好文   时间:2014-09-02 21:20:55    阅读次数:283
poj 1733带权并查集
L - Parity game Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Description Now and then you play the following game with your friend. Your f...
分类:其他好文   时间:2014-09-02 19:58:25    阅读次数:263
c++中临时变量不能作为非const的引用参数
试看下面的代码:#includeusingnamespacestd;voidf(int&a){coutusingnamespacestd;classCComplex{friendCComplexoperator+(constCComplex&cp1,constCComplex&cp2);friend...
分类:编程语言   时间:2014-08-30 20:18:49    阅读次数:212
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!