在C++程序中,经常用const 来限制对一个对象的操作,例如,将一个变量定义为const 的:
const int n=3;
则这个变量的值不能被修改,即不能对变量赋值。
const 这个关键字经常出现在函数的定义中,而且会出现在不同的位置,比如:
int strcmp (const char *str1,cons...
分类:
其他好文 时间:
2014-11-12 19:50:42
阅读次数:
198
C++中 const 是修饰常量的cons int* p --- 这个const 是修饰 *p的 也就是说 地址是可变的 但是 值 是不可变的int * const p --这个const 是修饰 p的 也就是说 地址是不可变的,但是 值是可变的const int* const p --这个修饰的是...
分类:
编程语言 时间:
2014-11-11 12:37:50
阅读次数:
170
传送门:ZOJ 1853
Description
Evolution is a long, long process with extreme complexity and involves many species. Dr. C. P. Lottery is currently investigating a simplified model of evolution: cons...
分类:
其他好文 时间:
2014-11-11 09:26:23
阅读次数:
239
Oracle中主键和唯一约束的区别,如何创建、删除、启用和禁用唯一约束...
分类:
数据库 时间:
2014-11-10 20:00:04
阅读次数:
276
Given a very large n-ary tree. Where the root node has some information which it wants to pass to all of its children down to the leaves with the cons...
分类:
其他好文 时间:
2014-11-09 06:13:47
阅读次数:
177
Java复用类
Java复用类一般有两种方法。
一,组合:在新的类中产生现有类的对象。由于新的类是由现有类的对象所组成,所以这种方法成为组合。
import java.util.*;
class WaterSource{
private String s;
WaterSource(){
System.out.println("WaterSource()");
s="cons...
分类:
编程语言 时间:
2014-11-08 23:44:40
阅读次数:
399
Determine whether an integer is a palindrome. Do this without extra space.Notes:1) Negative number is notpalindrome.2) Compare from head to tail, cons...
分类:
其他好文 时间:
2014-11-08 16:43:57
阅读次数:
124
题目地址:POJ 3678
算是2-SAT裸题了。。分类讨论就行了。。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define LL __int64
cons...
分类:
其他好文 时间:
2014-11-07 17:03:17
阅读次数:
181
类的成员函数后面加const,表明这个函数不会对这个类对象的数据成员(准确地说是非静态数据成员)作任何改变。在设计类的时候,一个原则就是对于不改变数据成员的成员函数都要在后面加const,而对于改变数据成员的成员函数不能加const。所以const关键字对成员函数的行为作了更加明确的限定:有cons...
分类:
编程语言 时间:
2014-11-02 20:46:34
阅读次数:
190