URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       techsuns
  HTML https://techsuns.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: OutPut of a Program
       *****************************************************
       #Post#: 376--------------------------------------------------
       c++ output
       By: dinesh Date: December 8, 2012, 8:58 am
       ---------------------------------------------------------
       #include <iostream>
       using namespace std;
       
       class Test
       {
       private:
       ~Test() {}
       };
       int main()
       {
       Test t;
       }
       Is this different from:
       #include <iostream>
       using namespace std;
       
       class Test
       {
       private:
       ~Test() {}
       };
       int main()
       {
       Test *t;
       }
       What are your thoughts on this...
       #Post#: 394--------------------------------------------------
       Re: c++ output
       By: satya Date: December 10, 2012, 10:41 pm
       ---------------------------------------------------------
       yes,,,both are different...........First one gives error whereas
       the second one works fine............. as the destructor is
       private here...........
       #Post#: 395--------------------------------------------------
       Re: c++ output
       By: dinesh Date: December 10, 2012, 10:46 pm
       ---------------------------------------------------------
       can you explain why...
       #Post#: 399--------------------------------------------------
       Re: c++ output
       By: nagendra Date: December 10, 2012, 11:13 pm
       ---------------------------------------------------------
       if a destructor is declared private, only dynamic objects can be
       created...( using new).....
       in case of second program, a pointer is created and not the
       object. so there is no need to call a destructor...
       #Post#: 410--------------------------------------------------
       Re: c++ output
       By: kpr29 Date: December 11, 2012, 3:06 am
       ---------------------------------------------------------
       @Nagi: Nice one.....
       *****************************************************