- 浏览: 458114 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (538)
- C/C++ Primer (69)
- Objective-C Primer (102)
- Python Primer (19)
- JavaScript Primer (1)
- Java Primer (37)
- PHP Primer (17)
- 泛 Linux (37)
- Shell Script (21)
- APUE (21)
- UNP__1&2 (19)
- NetWork (7)
- Oracle周边 (38)
- Mysql里边 (6)
- Windows技 (9)
- 简单算法 & 数据结构 (14)
- 设计模式 (6)
- GTK历程 (12)
- 工具使用 (25)
- 杂事 (23)
- 一些概念 (17)
- Web方面 (10)
- myCodeTools (9)
- ^未 竟$ (13)
- 硬件通信 (2)
- Games (1)
最新评论
http://topic.csdn.net/t/20061205/22/5209161.html
一、函数名后跟着const的函数,不能操作data-member
二、const可修饰函数名的前、中、后,中后会重载(前貌似不会吧)
一、函数名后跟着const的函数,不能操作data-member
二、const可修饰函数名的前、中、后,中后会重载(前貌似不会吧)
#include <iostream> #include <string> using namespace std; class R { public: R(int r1,int r2) {R1=r1;R2=r2;} void print(); void print() const; private: int R1,R2; }; void R::print() { cout << R1 - R2 << endl; } void R::print() const // assignment of data-member `R::R1' in read-only structure { cout << R1 + R2 << endl; } int main(int argc,char* argv[]) { R a(5,4); a.print(); const R b(5,4); // R被const修饰了,对象只读 b.print(); return 0; }
发表评论
-
float equal
2013-05-23 18:21 818- (BOOL)floatA:(float)f1 equalB ... -
C++序列化
2012-07-12 09:51 588http://hi.baidu.com/ewook/item/ ... -
C++著名内裤
2011-12-02 14:00 8091、C++各大有名库的介绍 ... -
C++写C
2011-09-06 17:23 637在C++中写C,标准头文件写法 #ifndef __AB ... -
errno.h
2011-05-05 14:27 687#define EPERM 1 ... -
__cplusplus
2011-04-21 15:09 736http://www.cnblogs.com/stonecra ... -
Pthread__常用
2011-04-21 11:46 851http://blogold.chinaunix.net/u/ ... -
常用预编译
2011-04-21 10:32 651#if defined(WIN32) || defined ... -
C++__容器
2011-04-18 10:16 552http://apps.hi.baidu.com/share/ ... -
C++模板
2011-03-29 14:27 623内容主要来至《钱能C++程序设计教程》&《C++ Pr ... -
交叉引用、前置声明
2011-03-02 09:40 802有两个类相互引用了,编译器报错。 原因是两个类交叉引用: A ... -
typedef的四个用途和两个陷阱
2010-12-14 12:34 649http://hi.baidu.com/changfeng01 ... -
第五届开源小组招新题目
2010-12-03 21:56 744这是学校的开源小组招新题。 08年时我是第二届的组长,不知不觉 ... -
string const char*
2010-12-02 16:13 770http://topic.csdn.net/u/2008092 ... -
CPP Container
2010-11-10 09:20 713延后整理。。。 -
C语言运算符优先级
2010-11-02 17:45 787优先级 运算符 ... -
point point
2010-11-02 17:23 618http://learn.akae.cn/media/ch23 ... -
位运算
2010-11-01 11:33 781千百年来,位运算始终没出现在我写的代码里,今天终于出现了。 ... -
Unix环境下操作特大文件
2010-11-01 11:03 612http://hi.baidu.com/jiangfeng11 ... -
GCC在C语言中内嵌汇编
2010-10-22 14:48 1367http://hi.baidu.com/liu_bin0101 ...
相关推荐
Other C++ Features Reference Arguments Function Overloading Default Arguments Variable-Length Arrays and alloca() Friends Exceptions Run-Time Type Information (RTTI) Casting Streams Preincrement and ...
it is a parameter, indicating the address of the object, so it can only be used inside the function, and it only makes sense after the object is instantiated. 3. static_cast、reintepret_cast 和 const...
- **Pre-increment and Pre-decrement:** Prefer pre-increment and pre-decrement over post-increment and post-decrement when the value is not needed after the operation. - **Use of const:** Use const for...
RSP-28476 LSP ErrorInsight in Structure Pane only shows one keystroke after editor RSP-28400 [BadCG] Operator Assign is not always invoked for fields RSP-28372 [Regression] Bad codegen in function ...
extern iconv_t iconv_open (const char* tocode, const char* fromcode); /* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes starting at ‘*inbuf’, writing at most ‘*...
64. **Reference to local variable 'xxx' after its lifetime** - 'xxx'生命周期结束后引用局部变量:在变量的作用域之外引用变量。确保只在变量的生命周期内引用变量。 65. **Size of array 'xxx' depends on ...
size_t hashFunction(const std::string& key) const; }; #endif // HASH_H ``` 在`hash.h`中,`hashFunction`是关键的部分,因为它将键转换为哈希值,分配到存储桶中。常见的哈希函数包括简单的模运算、DJB2哈希...
stdafx.h的代码// This is a part of the Microsoft Foundation Classes C++ library. // Copyright (C) 1992-1998 Microsoft Corporation // All rights reserved. // // This source code is only intended as a ...
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_FIGURE_H__2830E4B2_3CD3_4E32_AD84_273816B535D0__INCLUDED_)
Visual C++MFC入门教程 目录 +-- 第一章 VC入门 |------ 1.1 如何学好VC |------ 1.2 理解Windows消息机制 |------ 1.3 利用Visual C++/MFC开发Windows程序的优势 |------ 1.4 利用MFC进行开发的通用方法介绍 |----...
在第三个问题中,程序员需要判断抽象类的定义:抽象类是一种类,它 declare with the keyword abstract(has at least one virtual function)。 数组和指针的关系 在C++中,数组和指针有着紧密的关系。数组可以隐式...
void DLLDIR __stdcall Bubblesort(byte* array, int size, int elem_size, CompareFunction cmpFunc) { for (int i = 0; i ; i++) { for (int j = 0; j ; j++) { // 比较元素 if (1 == (*cmpFunc)(array + j * ...
- FIX: After deleting the selected points in the TFlexPanel.DeleteSelectedPoints the all figures with one point also deleted. - FIX: When the curve contain more then one figure and they were all ...
// necessary after I rewrote the code as a template. Others helped me // improve the CString facade. // // Anyway, these people are (in chronological order): // // - Pete the Plumber (???) // -...
* Go for the biggest classes first - if you see a TMyFom <class> leaking, try to fix this one first instead of going after a tiny TFont class. Since a Form will usually contain a lot of other classes,...
Used to retain the value of a variable even after the end of the block. - **Lifetime:** Until the end of the program. - **Scope:** Limited to the current block. ##### The extern Storage Class Used ...
3.After several days researching about hard SPI to drive LCD, failed. So switch to use a faster GPIO method, as below: Replace "#define LCD_RST_H() GPIO_SetBits(LCD_CTRL_PORT, LCD_RST)" in ST ...
32)..Fixed: Memory leak after low-level unhook of function 33)..Fixed: Re-parenting after ReallocMem 34)..Fixed: Editing SMTP server options 35)..Fixed: SMTP server not using real user...
Is 'Function Renamer' to transfer the function names from one simulare file to your decompiled au3-file. A simulare file can be a included 'include files' but can be also an older version of the ...
们之间的纽带仅仅在于这个C++窗口类内部的成员变量m_hWnd,该变量保存了与这个C++窗口类对象相关的哪个窗口 的句柄 (3)但是,当C++窗口类对象销毁时,与之相关的窗口也将销毁,因为它们之间的纽带m_hWnd已经断了 3、...