In C++ Suppose I have
class Sample{
public:
void someFunction();
};
In main() is there any difference between doing
Sample obj;
obj.someFunction();
AND
Sample *obj = new Sample();
obj->someFunction();
Is it only a matter of syntax or is there a performance/implementation difference? When should one be used over the other? Can I implement linked list using obj instead of *obj?