原创 C/C++: static
C++中static要點總結: 1、靜態成員的提出是爲了解決數據共享的問題。 2、因爲靜態成員函數是屬於類的一部分,而不是某個對象的一部分,因此靜態成員函數沒有this指針,this指針是用於指向某個對象的。又因爲靜態成員函數沒有this
原创 Understanding Unix/Linux Programming note:chapter 6:爲用戶編程:終端控制和信號
Key-word: stty,tcgetattr, tcsetattr, fcntl, signal, 終端驅動程序的模式、阻塞/非阻塞輸入 一、內容概要 Chapter 6的內容是chapter 5內容的應用和擴展。
原创 數據結構與算法分析:第一章:Finding the kth largest number and The four basic rules of recursion
查找第K個最大值的兩種方法;遞歸的四條基本法則。 書中首先介紹了兩種簡單的方法: One way to solve this problem would be to read the n numbers into an array, so
原创 Understanding Unix/Linux Programming 筆記:chapter 9:可編程的shell、shell變量和環境; chapter 10:I/O重定向和管道
Chapter 9 UnderstandingUnix/Linux Programming 筆記:chapter 9:可編程的shell、shell變量和環境:編寫自己的shell Key-word: 本章繼續完善上章的
原创 C++ primer 筆記:繼承與靜態成員
如果基類定義了static成員,則整個繼承層次中中只有一個這樣的成員。無論從基類派生出多少個派生類,每個static成員只有一個。 static成員遵循常規訪問控制:若果成員在基類中爲private,則派生類不能訪問它。假定可以訪問成員,
原创 vim常用命令
注意事項: 修改完代碼之後,一定要保存,再重新編譯。 一、光標移動 1、向後移動 w:使得光標向前移到一個單詞; b:向後移動一個單詞; e:也是向前移到一個單詞,但是將光標定位在單詞的結尾處; ge:則是向後移到一個單詞併
原创 陳皓-C++ 對象的內存佈局(上):筆記
單一的一般繼承 代碼如下: #include <iostream> using namespace std; class Parent { public: int iparent; Parent ():iparen
原创 private, protected, public疑惑
1、 class base { public: base(int i = 1):pri(i) {} int fun(base &b) { return pri + b.pri; } private: int pri;
原创 Understanding Unix/Linux Programming 筆記:chapter 8:進程和程序:編寫命令解釋器sh
Key-word: execvp,fork, wait 基本概念: 一個可執行程序是一個機器指令及其數據的序列。一個進程是程序運行時的內存空間和設置。 進程存在於用戶空間。 內容概要: 本章要編寫
原创 Understanding Unix/Linux Programming note:chapter 2, chapter 3, chapter 4
chapter 2: Key-word: open file, read file, who, cp, logout 通過介紹who命令的編寫來講解Unix對文件的操作。 who命令用於顯示系統中活動用戶的
原创 驗證:合成的複製構造函數是位拷貝的
以下摘自林銳的高質量C++編程: 如果不主動編寫拷貝構造函數和賦值函數,編譯器將以“位拷貝”的方式自動生成缺省的函數。倘若類中含有指針變量,那麼這兩個缺省的函數就隱含了錯誤。以類String 的兩個對象a,b 爲例,假設a
原创 telnetlib
The telnetlib module provides a Telnet class that implements the Telnet protocol. 也就是說,可以通過該模塊連接telnet server。 官方文檔給
原创 陳皓:C++ 虛函數表解析----筆記
文章鏈接:http://blog.csdn.net/haoel/article/details/1948051 虛函數表 C++中的虛函數的作用主要是實現了多態的機制。關於多態,簡而言之就是用父類型別的指針指向其子類的實
原创 Virtual Destructor
Base *b = new Derived(); // use b delete b; // Here's the problem!如果析構函數不是虛函數,則運行哪個析構函數是由該指針的類型決定的。如上例,若類Base的析構函數不是虛函
原创 urllib2: Basic Authentication
http://www.voidspace.org.uk/python/articles/authentication.shtml#base64 http://kentsjohnson.com/kk/00010.html Basic Au