Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Why do I need to allocate space for myobject? doesn't that happen when I do myObject = new MyObject()? Commented Nov 23, 2013 at 2:50
  • And do you mean MyObject *MyClass::myObject? Commented Nov 23, 2013 at 2:51
  • No. That allocates space for an object, myObject is a pointer, not an object. You never allocated space for MyObject::myObject, the pointer that you said in the header file was going to exist. (This is to your first question. I'm not sure what you mean in your second question. Are you asking about the style issue of where the space goes?) Commented Nov 23, 2013 at 2:51