title: Can I implement linked list using object of a class instead of pointer to an object?
body: <p>In C++ Suppose I have</p>
  <pre><code>class Sample{
   public:
   void someFunction();
  };
  </code></pre>
  <p>In main() is there any difference between doing</p>
  <pre><code>Sample obj;
  obj.someFunction();
  
  AND
  
  Sample *obj = new Sample();
  obj-&gt;someFunction();
  delete obj;
  </code></pre>
  <p>Can I use just obj instead of *obj to implement the linkedlist and tree data structure in C++? That's the only doubt.</p>