Original Post
Hi, I am writing my own smart pointer class, which seems to be working so far, but I was a little confused as there was a point I was expecting the compiler to complain when it didn't. I have the test code... which works fine when I have the constructors... but when I comment out the second constructor it STILL works. Why wouldn't the last line on the first section of code (MyTestPtr testp3=testp2) fail if there wasn't a constructor for the SmartPointer? BTW, MyTestPtr is just a typedef for a smart pointer to the test class MyTest (ie typedef SmartPointer<MyTest> MyTestPtr). Thanks
MyTest* test2=new MyTest();
MyTestPtr testp1=test2;
MyTestPtr testp2=test2;
MyTestPtr testp3=testp2;
SmartPointer(T* in_object);
SmartPointer(SmartPointer& in_smartPointer);