Saturday, August 4, 2007

c++ review in a blast (core)


//1. virutal function
//2. abstract base class, pure virtual function
//3. pure virtual definition is allowed
//4. reference - i is x itself
//5. when reference, when pointer
//6. reference - no "reseating", on the skin, pointers on the inside
//7. reference - exception "sentinel" reference, null pointer
//8. handle to an object - way to let you get to another object
//9. class, struct
//10. inline function, why inline not #define
//11. constructor calls in an inheritance hierarchy
//12. destructor calls in an inheritance hierarchy
//13. the need for virtual destructor - type of the pointer is that of the base / memory leak
//14. pure virtual destructor is not allowed
//15. constructors cannot be virtual - virtual table not yet available in memory
//16. overhead in searching virtual table
//17. virtual keyword need not be restated
//18. functionality can be overridden in the derived class
//19. dynamic binding - calls to virtual functions are resolve at runtime
//20. prominent reason to use virtual function - to have different functionality in the derived
//21. non-virtual member functions are resolved at compile time]
//22. virtual constructor for each class (vptr at start of object, vtable class-specific)
//23. inline function - the function is expanded in the calling block
//24. not treated as separate unit like other functions
//25. compiler is free to decide
//26. if it has large chunk of code, it will not be considered inline
//27. in function declaration, inline keyword is not used
//29. inline keyword in function definition
//30. actually not necessary, if function is defined in declaration with small chunk of code
//31. static data types, static functions
//32. differences between a static member function and a non-static member function
//33. a static member function can access static member data, other static member function,
// data and function outside the class.
//34. no instantiation needed
//35. cannot be virtual
//36. cannot have access to the 'this' pointer of the class
//37. 'this' pointer - object x of class A with non-static member function f()
// in the call to x.f() - the keyword 'this' in the body of f() stores the address of x
//38. cannot declare it or assignment to it
//39. static member function does not have 'this' pointer
//40. type of 'this' pointer is X* const
//41. if member function is declared with 'const' qualifier, type of 'this' is const X* const
//42. a const this pointer can only be used with const member functions
//43. data members of the class will be constant within that function
//44. member mutable - volatile
//45. 'this' is passed as hidden argument to all non-static member functions
// and is available as local variable within the body of all non-static member functions
//46. this->a = a;
//47. 'this' may not be necessary for visible member functions.
//48. can use it to differentiate parameter and member data with the same name
//49. address operator