Comparing with the 'I' one, there are two changes:1. if last operator is "+" or "-", we don't evaluate expression2. if last operator is "*" or "/", we...
分类:
其他好文 时间:
2015-06-22 13:37:36
阅读次数:
425
1:将/etc/passwd中有root字符的行显示出来1 [root@bogon zkero]# grep -n 'root' /etc/passwd2 1:root:x:0:0:root:/root:/bin/bash3 11:operator:x:11:0:operator:/root:/sb...
分类:
系统相关 时间:
2015-06-22 07:32:45
阅读次数:
200
class mypoint{
var x:Int =1;
var y:Int =1;
init(#x:Int,#y:Int){
self.x = x;
self.y = y;
}
var description:String{//在这里稍有贪心,做一描述成员get变量
get{
ret...
分类:
编程语言 时间:
2015-06-21 18:37:48
阅读次数:
139
hash结构体
struct Hash_map
{
static const int mask=0x7fffff;
int p[8388608],q[8388608];
void clear(){
for(int i=0;i<=mask;++i)
q[i]=0;
}
int & operator [...
分类:
其他好文 时间:
2015-06-21 09:28:10
阅读次数:
130
#include using namespace std;class num{public: num(){n=new int;*n=1;coutx=a.x;cout two.operator =(one); cout<<two.getX()<<endl; retur...
分类:
编程语言 时间:
2015-06-20 23:29:40
阅读次数:
235
本文介绍这三种new/delete之间的区别和联系。...
分类:
其他好文 时间:
2015-06-19 13:31:22
阅读次数:
89
1 void showTime() const; 2 Clock& operator ++(); 3 Clock operator ++(int); 4 private: 5 int hour,minute,second; 6 }; 7 Clock::Clock(i...
分类:
编程语言 时间:
2015-06-18 13:18:20
阅读次数:
213
1 #include 2 using namespace std; 3 class Complex{ 4 public: 5 Complex(double r=0.0,double i=0.0):real(r),imag(i){} 6 friend Complex operator...
分类:
编程语言 时间:
2015-06-18 12:57:12
阅读次数:
226
#includeusing namespace std;class Complex{public: Complex(double r=0.0,double i=0.0):real(r),imag(i){} Complex operator + (const Complex &c2) co...
分类:
编程语言 时间:
2015-06-18 12:56:41
阅读次数:
144
class Test
{
Test& operator= (const Test& t)
{
}
}
这个是我们熟悉的赋值操作符函数的格式,但是该函数为什么非得要返回一个引用呢。
查阅了很多资料感觉这种解释比较靠谱:
Test a,b,c;
a=b=c
这里存在连续赋值,这是符合C++的语法规范的。如果赋值操作符返回一个引用类型...
分类:
编程语言 时间:
2015-06-18 11:33:34
阅读次数:
156