/*BASIC*/ long LargeNum = 9L; // 'L' indicates it is a long integer char letter = 'A'; // it's 'A' not "A" unsigned long years = 2000UL; // 'UL' for unsigned long const float PI = 3.1415926f; // 'f' for float, capital letters "PI" for const int data[100] = {0}; // initialize all elements to 0 /*INTERMEDIATE*/ enum Title {Mr, Ms} aPerson; // aPerson is a variable of Title not integer, Mr = 0 aPerson = Ms; int i = Ms; // i = 1 static int j; // j exists for the life of the program Loop begins; continue; // continue to execute the next loop and ignore "break" break; // get out of the loop directly Loop ends; Pointers int *pdata, number = 2000; // declare an integer point & a number pdata = &number; // store address of number in the pointer number = *pdate + 1; // add 1 after de-referencing the pointer // number is 2001, pdate is still the address of number // indirection operator * is not multiply symbol * // address operator & is not a reference symbol & void *pvoid; // no type pointer pvoid = &number; // store address // newNum = *pvoid; // error, no datatype newNum = *(int *)pvoid; // type cast, then dereference const int *pnum = &number; // *pnum can't be used to change number int * const pnum = &number; // pnum can't be changed, but *pnum can inline int d(int c = 0) {return c++;} // default value overload give several functions in a program the same name polimorphism a reference variable can be viewed as an alias (duplicate) fro a defined variable, which must be defined initialised int number = 9; int &refnum = number; it is more efficient and easier to pass objects by reference than to pass objects by value. int & inc(int & c) { c++; return c; } int number = 9; number = inc(number); // number = 10 Template for dynamic create an object Ptr = new type []; // allocate storage // blabla delete [] ptr; //delocate Class void myfunc(int) const; // can’t change the recipient’s/object’s data // passing by reference is as efficient as passing a pointer to an object. // But it is safer to do that. int myfunc(Myclass &); // pass by reference int myfunc(Myclass *); // pass by pointer class A; // forward declaration class B { private: A *aA; // no problem because of forward declaration static int num; // all objects share num Public: static void doNothing() () // function independent on objects } Polymorphism //It's not overload. When you overload a function, you can have several functions with the same name, but each with a different set of arguments. class Base { public: void hello(); virtual void hi(); } class Derived : public Base { public: hello(); virtual void hi(); } Base *BasePtr, *DerivedPtr; BasePtr = new Base; DerivedPtr = new Derived; BasePtr->hello(); BasePtr->hi(); DerivedPtr->hello(); // = BasePtr->hello(), because it's the Base pointer DerivedPtr->hi(); // polymorphism Template template class LinkedList { public: T GetData(); LinkedList *GetNext(); protected: T Data; LinkedList *Next; } LinkedList FloatList; books: C++ for Professional Programming with PC and UNIX Applications, Stephen Blaha. The Premier C++ Visual C++ 4 How to