Can any body tell me in the following statement what the function of the line 'class Memory *memory;' is? Is it some kind of nesting? I couldn't find a similar statement in documentation part.
No. Class Memory is being forward declared, and memory is being declared as a pointer to Memory. That means the compiler doesn't need to know anything about Memory but its name. You can only use pointers with forward declarations, though.