Saturday, November 24, 2007

Notes on reading "Thinking in C++"

I am reading the book Thinking in C++ these days. I will write down some important points in this post during my reading.

1. Difference on overloading and overriding:
Overriding - same methods with same arguments and same return types associated in a class and its subclass
Overloading - same methods with different arguments, may or may not be same return type written in the same class itself
-------------------------------------
Example for overriding
Class A { Virtual void hi(int a) { }}
Class B: public A{ public overrid void hi(int a){ }}

Example for overloading
Class A {a(){} a(int a){}}
-------------------------------------

2. two ways to re-use the codes: compoition and inheritance

3. Three points on OOP: abstract data type, inheritance, polymorphism

4. Precedure of compilation: (1) pre-processing (2) compilation: (a) syntax analysis->tree structure (b) code generator->assemble code/machine code (get .obj) (3) linker. Some points: global optimizer, peephole optimizer, static type checking, dynamic type checking

5. All C++ library are in name space of std

6.

No comments: