我自定义了一个模板类并重载了运算符,预定义实现功能为能实现对数组一般操作,类似于vector。
#ifndef ARRAY_H
#define ARRAY_H
#include
using namespace std;
template
class Array{
friend ostream& operator<<(ostream&, const Array &);
friend i...
分类:
其他好文 时间:
2015-07-31 20:23:16
阅读次数:
108
Member functionsFunctions declared in the definition of a class, excluding those declared with a friend specifier (11.3), arecalled member functions o...
分类:
编程语言 时间:
2015-07-31 14:45:23
阅读次数:
139
1. 接口的实现类中的实现接口中的抽象方法的方法必须为public,为什么? 接口中所有的方法与变量都默认是 public 的,在接口中可以不写出来。但在实现类中,如果不明写的话,就变成了 friend 的了,也就是 “包访问权限”。而JAVA又规定,在实现接口或者覆写父类方法时,不能降低父类方法的...
分类:
编程语言 时间:
2015-07-30 00:24:17
阅读次数:
144
题目链接题意: 两个人坐火车, 在某个城市到站的时间段分别为[t1, t2] , [s1, s2],停在站台的时间均为w。 问, 若两人能见面的概率。思路: 一道基础的几何概型, p = s(m)/s(n)。 令x1 = t1, x2 = t2。 令y1 = s1, y2 = s2。 这...
分类:
其他好文 时间:
2015-07-28 12:50:25
阅读次数:
90
骑士的移动题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=83498#problem/E题目:DescriptionA friend of you is doing research on theTraveling Knight ...
分类:
移动开发 时间:
2015-07-26 20:42:37
阅读次数:
154
本文译自How to sort NSArray with custom objects。我们开发的每个程序都会使用到一些数据,而这些数据一般被封装在一个自定义的类中。例如一个音乐程序可能会有一个Song类,聊天程序则又一个 Friend类,点菜程序会有一个Recipe类等。有时候我们希望在程序中显示...
分类:
移动开发 时间:
2015-07-26 16:58:02
阅读次数:
152
DescriptionNow and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a c...
分类:
其他好文 时间:
2015-07-26 12:23:46
阅读次数:
113
Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluDescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where...
分类:
其他好文 时间:
2015-07-24 22:17:15
阅读次数:
116
namespace ss{
class string {
friend ostream& operator <<(ostream&, const string&);
char *_str;
public:
string():_str(new char[1]){
_str[0] = '\0';
}...
分类:
其他好文 时间:
2015-07-24 18:34:41
阅读次数:
98
#include
using namespace std;
class INT
{
public:
friend ostream& operator<<(ostream& os, const INT& i); INT(int i) : m_i(i) {}; INT& operator++()
{...
分类:
其他好文 时间:
2015-07-24 18:24:07
阅读次数:
158