#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
                             
                    
                        
                            
                            
                                点击打开链接
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
                             
                    
                        
                            
                            
                                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
                             
                    
                        
                            
                            
                                mystring.h
#ifndef _MYSTRING_H_
#define _MYSTRING_H_
#include 
#include 
class mystring
{
    friend std::ostream &operator<...
                            
                            
                                分类:
其他好文   时间:
2014-09-06 09:49:13   
                                阅读次数:
214
                             
                    
                        
                            
                            
                                友元:假设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
                             
                    
                        
                            
                            
                                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
                             
                    
                        
                            
                            
                                试看下面的代码:#includeusingnamespacestd;voidf(int&a){coutusingnamespacestd;classCComplex{friendCComplexoperator+(constCComplex&cp1,constCComplex&cp2);friend...
                            
                            
                                分类:
编程语言   时间:
2014-08-30 20:18:49   
                                阅读次数:
212