2011年6月30日 星期四

C++ warm up

1. private/protected/public
Protected 的成員可被後代存取, private不行

2. friend
朋友可以存取朋友的所有member

3. virtual function (有點類似interface??)
若為virtual function, 在base型別被呼叫時, 搜尋順序為 derived > based
若非virtual function, 在base型別被呼叫時, 只會搜尋based.
若非virtual function, 在derived型別被呼叫時, 搜尋順序為 derived > based

4. virtual inheritance
多重繼承發生時, 若有相同的基底時, virtual的基底只會生出一份.
e.g. B繼承A, C也繼承A, D同時多重繼承B和C, 若A非虛擬則會生出兩份A, 建構子被呼叫兩次, 若為虛擬則只會生出一份A, 建構子只被呼叫一次.

class A{
public:
int AA;
}

class B: public class A{
public:
int BB;
}

class C: public class A{
public:
int CC;
}

class D: public B, C {
public:
int DD;
}



A---->B---+
|--->D
A---->C---+

+->B---+
A--| |--->D
+->C---+


5. const
const變數繼承時只有一份, 不能更改值.
const函式只能acess const變數.

2011年6月8日 星期三

Waited to be read.

  • Thread Local Variable
http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Thread-Local.html
  • Linux Kernel Thread
http://linux.sheup.com/linux/linux7553.htm
  • Kernel Boot
http://adrianhuang.blogspot.com/2009/12/introduction-to-linux-kernel-booting.html
http://duartes.org/gustavo/blog/post/kernel-boot-process
  • DRAM
http://www.embeddedlinuxprimer.com/dram_basics

Nexus S recovery menu

1. Power off
2. Press PWR+VOL UP
3. Select Recovery. Use VOL UP/DOWN to move cursor and PWR to select.
4. You will see ! and Android Robot
5. Following step 4, press PWR for a while and then press VOL UP without releasing PWR.
6. After Step 5, recovery menu pops up.
Ref. Manually update your Nexus S or Nexus One to the latest OTA update