1

For me, I prefer having all my variables, not as pointers. Is it ok to keep all heap-allocated variables dereferenced?

For example:

#include "Foo.hpp"
#include "Bar.hpp"

class Foo {
private:
 Bar* ptr = new Bar();
};

Would it be ok to have Bar as a dereferenced pointer, without causing any issues?

Bar b = *(new Bar());

closed as off-topic by RockPaperLizard May 29 at 7:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.