deleting smart pointer, but still could able to access the pointee?
<p>I have returned the pointee type from  operator T*(), and invoked delete operator over smart pointer, and tried invoking the member function, and i have not got any run time error. How is that possible?  Or is my understanding is wrong? Kindly suggest.</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

template &lt;typename T&gt;
class sPtr
{
    private:
       T * pointee__;
     public:

        operator T * () {
                cout &lt;&lt;"Inside T* () "&lt;&lt;endl;
                return pointee__;
        };
    explicit sPtr ( T * t )
    {

      pointee__ = t;
    };
    T * operator-&gt;() {
        return pointee__;
     }
};

class JTest
{
 private:
        int x;
 public:
   JTest ( int l=100) { x=l; };
    void display ();
};

void JTest::display()
{
  cout &lt;&lt;"Display API x is "&lt;&lt;x&lt;&lt;endl;
}

void JFunc (JTest * tmp)
{
  cout &lt;&lt;" JFunc"&lt;&lt;endl;
  tmp-&gt;display ();
  cout &lt;&lt;"Invoking JTest -&gt; display "&lt;&lt;endl;
}


int main ( int argc, char ** argv)
{
 sPtr &lt;JTest&gt; t(new JTest);
 t-&gt;display();
 delete t; // Invokes operator T* () , and it is dangerous!!!..
t-&gt;display  ();

}
</code></pre>

<p><strong>OUTPUT:</strong></p>

<pre><code>Display API x is 100
Inside T* () 
Display API x is 100
</code></pre>
