What are the differences between declaring a variable in a header file as pointer or non-pointer? I am not sure if I understand the differences correctly.
E.g.
class MyClass {
private:
    MyOtherClass* moc; // pointer
    MyOtherClass moc2; // no pointer
}
So far I have come up with the following advantages/disadvantages when declaring a variable as pointer.
Advantages:
- Lazy instantiation (no immediate creation of the object)
- Variable lives on the heap which is much larger than the stack
- Not only the default constructor can be used
Disadvantages:
- Must be deleted manually in the destructor (btw. when is such a non-pointer variable destructed? When the program ends?)
What else is there to say?
 
     
     
     
    