What did i learn from "Inside the C++ Object Model" ?


  1. struct or class, there is no major difference. We should not confuse much.
  2. Template is something that is very specific to C++.
  3. Virtual are something that is very specific to C++.
  4. Difference between Object Based and Object Oriented.
  5. Assembly, C, Abstract Data Type, Object Oriented programming.
  6. All the codes in a binary should be compiled using same compiler.
  7. C program’s trick is sometimes a C++ program’s trap.
  8. Relation between polymorphism and pointers/references. Only the indirect manipulation of the object through a pointer or reference supports the polymorphism necessary for )) programming.
  9. In C++, polymorphism exists only within individual public class hierarchies.
  10. The encapsulation of the type information is maintained not in “pointer” but in the link between the object’s vptr and the virtual table the vptr addresses.
  11. When you assign an object of derived class to object of base class then “slicing” happens. This is one of the reason why polymorphism does not works with objects.
  12. Can we inline any member function ? It’s all depends on the complexity of the function. “inline” is just a request to the compiler. Compiler decides whether it needs to inline or not. You can’t force it.
  13. Compiler exhibits codes when it is “needed”.
        There are two meaning to this word “needed”:
               Needs of the Implementation.
               Needs of the Program.
  14. Compiler exhibits codes only when there is a implementation need.
  15. Difference between Copy Constructor and Copy Assignment operator. A target objects copy constructor is called when it is initialized by a source object and target object was not exist before that. A target objects copy assignment operator is called when it is assigned to a source object and targetobject is exist during this period. In short, Copy constructor during target object creation & initialization. Copy assignment operator during target object re-initialization.
  16. Does compiler exhibits default constructor of all the classes ? No. It’s all depends
    on the implementation needs.
  17. Does compiler augument default constructor of all the classes ? No. It’s all depends
    on the implementation needs.
  18. Does compiler exhibits copy constructor of all the classes ? No. It’s all depends
    on the implementation needs.
  19. Does compiler exhibits copy assignment function of all the classes ? No. It’s all depends
    on the implementation needs.
  20. Does compiler exhibits destructor of all the classes ? No. It’s all depends
    on the implementation needs.
  21. If other constructors are included by the class designer except default constructor then will
    compiler include the default constructor ? No.
  22. Does compiler-synthesized default constructor provides explicit default initializers for each
    data members declared within the class ? No.
  23. Can a copy constructors may be multi-argument ? Yes. Only if the second and following arguments has a default value.
  24. Bitwise copy Semantics -> This class can be copied bit-by-bit.
  25. Copy constructor is called when you pass an object by value. Either during function call
    or during function return.
  26. Named Return value(NRV) Optimization.
  27. NRV and copy constructor relation.
  28. Member initialization list improves program performance at certain times.
  29. Member initialization list must be used at certain times.
        Initialization of reference member.
        Initialization of const member.
        When invoking a base or member class constructor with a set of arguments.
  30. The order in which the member initialization list entries are set down is determined
    by the declaration order of the members within the class, not the order within the
    initialization list.
  31. When you use Member initialization list to initialize one member with another
    member , place that initialization within the body of the constructor.
  32. Use of member functions within Member initialization list is valid.
  33. A virtual base class subobject occurs only once in the derived class regardless of the
    number of times it occurs within the class inheritance hierarchy.
  34. C++ standard does not mandate details such as the ordering of
    either base class subobjects or of data members across access levels.
  35. Standard requires within an access section only that the members be set down such that “Later members have higher addresses within a class object”
  36. Standard does not specify where to insert the “vptr”.
  37. The standard allows the compiler the freedom to order the data members within
    multiple access sections within a class in whatever order it sees fit.
  38. Static data members are maintained within global data segment of the program.
  39. Each reference to the static member through either pointer/reference/object is internally translated to be a direct reference to that in the global data segment.
  40. Static data members defined in the class are name-mangled. So you can have
    same static member name in two different classes.
  41. The language still requires the general defensive programming style of
    always placing nested type declarations at the beginning of the class.
  42. Name-mangling algorithm is unique to each and every compiler.
  43. Base class members always appear first, except in the case of a virtual base
  44. Pointer assignments/casting can result in different pointer value. It is different
    from C.
    This is the basis of COM programming.
  45. When you use Multiple inheritance or virtual inheritance, compiler will intervene
    when you assign an pointer of one type to pointer of another type. Compiler exhibited code always check whether the passed source pointer is NULL or not.
  46. Conversion of reference need not defend itself against a possible NULL value,
    since the reference cannot refer to no object.
  47. When you use single inheritance most of the time pointer assignment will not change its value. Except in a case where base object don’t have virtual function and derived class has a virtual function.
This entry was posted in Books, C/C++ and tagged , , , . Bookmark the permalink.

5 Responses to What did i learn from "Inside the C++ Object Model" ?

  1. deadalnix says:

    Template is something that is very specific to C++ => You may want to look at D.

  2. Ian Kerr says:

    Ada 80 introduced the template called a generic with the notation. Perhaps it was not the first use. C++ introduced it in cfront 2.1 . Please point out where you say you are only comparing C with C++?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s