How to write a Copy Constructor

 

Hello,

How do I write a copy constructor for a public class (structure substitute) please?

For sake of an example lets say the public class is as below:

   class struct : public CObject
     {
   public:
      double         a;
      datetime       b;
     };

I'm using this structure with CArrayObj hence the reason it is inherited from CObject.

And I want make a copy constructor for this class.

Thanks.

 
imamushroom: And I want make a copy constructor for this class.
class thisClass{
 public:
   thisClass(void)                  : a(0), b(0){}            // Default Constructor
   thisClass(const thisClass& that) : a(that.a), b(that.b) {} // Copy Constructor
   double   a;
   datetime b;
};
 
William Roeder:

Thanks very much

Reason: