I was trying to post a question to Stack Overflow but I can not because it
doesn't meet quality standards
How can I know what need to be fixed in my question so it become "meeting quality standards"? Adding question below
In c++ I can declare field as regular variable of some type, instatiate it in constructor, and use it later:
private: Foo field; ... A::A() { field = FieldImpl(); } .... method(field);
Or alternatively i can use pointer:
private: Foo* field; ... A::A() { field = new FieldImpl(); } A::~A() { delete field; } ... method(*field);
What is prons and cons of declaring field as pointer? When declaring field how to decide if I should use pointer or regular variable?
i
(between the code blocks) - that's bad English. Use an uppercaseI
when writing about yourself.a
might help too: I can declare a field as a regular variable and alternatively I can use a pointer.