#include <iostream>
struct something{
int i;
something(int i) : i(i) {}
};
class otherthing {
otherthing(){}
static something foo(int value)
{
return { value };
}
};
In this example what the foo function returns? Am I understand correctly that it creates an object on the heap and returns a pointer? Is this considered bad style? Or is it ok for structs and not classes?
I can feel that it might be a stupid question but I tried to google it and I could not find the answer. I apologize in advance if this is dumb.