Descriptionliympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many times, he is tired o...
分类:
其他好文 时间:
2014-12-15 23:15:31
阅读次数:
287
#include #include using namespace std;#define DO_NOTHING()#define DESTROY_POINTER(ptr) if (ptr) { delete ptr; ptr = NULL; }class Component{ friend ...
分类:
其他好文 时间:
2014-12-12 11:15:31
阅读次数:
133
POJ 1474Video SurveillanceTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 3392Accepted: 1497DescriptionA friend of yours has taken the job of...
分类:
其他好文 时间:
2014-12-09 19:35:08
阅读次数:
303
对于每个构造函数来说,都有一个prototype属性。对于每个对象实例来说,都有_proto_属性。 参看下面代码:function Person(){}var friend = new Person();Person.prototype={ constructor:Person, name:...
分类:
其他好文 时间:
2014-12-08 20:59:01
阅读次数:
130
注: 友元是一种定义在类外部的普通函数或类,但它需要在类体内进行说明,为了与该类的成员函数加以区别,在说明时前面加以关键字friend。友元不是成员函数,但是它可以访问类中的私有成员。所以,友元声明只能出现在类定义中。因为友元不是授权类的成员,所以它不受其所在类的声明区域public private 和protected 的影响。即友元函数的声明可以出现在类的任何地方
class A
{...
分类:
其他好文 时间:
2014-12-08 17:55:07
阅读次数:
121
原文:http://favbulous.com/post/1001/24-unique-ios-login-screen-showcaseEeveEvernote FoodRecoodHipsterMingle!FlipboardShowyouFacebookPiictuFind Mt Friend...
分类:
移动开发 时间:
2014-12-05 07:03:01
阅读次数:
1276
问题描述: 有一批共n个集装箱要装上2艘载重量分别为c1和c2的轮船,其中集装箱i的重量是wi,且不能超。算法思想: 最优装载方案: 将第一艘轮船尽可能的装满; 然后将剩余的装载第二艘船上算法描述:template class Loading{ friend Type MaxLoadin...
分类:
其他好文 时间:
2014-12-04 17:35:50
阅读次数:
338
最近这些天在重温设计模式GOF23,偶然想到友元,不使用都快忘了
今天重温一下C++友元知识,学了之后几乎就没怎么用到,几乎都是与设计模式打交道的。
虽然说友元能提高效率,表达清晰,但是破坏了类的封装机制,所以一般情况下不建议使用友元,
友元类简单demo:
// 类A,希望把私有成员公开给类B
class A
{
friend class B;// 把B设置为友元类
public...
分类:
编程语言 时间:
2014-12-04 08:51:54
阅读次数:
163
K.Bro Sorting
Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)
Total Submission(s): 71 Accepted Submission(s): 40
Problem Description
Matt’s friend ...
分类:
其他好文 时间:
2014-11-30 00:38:14
阅读次数:
154
K.Bro Sorting
Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)
Total Submission(s): 67 Accepted Submission(s): 39
Problem Description
Matt’s friend ...
分类:
其他好文 时间:
2014-11-29 23:07:06
阅读次数:
324