andrewmchorney
asked on
Ifstream/ofstream objects in copy/assigment constructors
I am trying to finish a copy and assignment constructor. There is a ifstream and ofstream in the source object. I tried to do an assignment of the 2 objects and I am getting compile errors. How does one do this ?
Thanks,
Andrew
Thanks,
Andrew
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To add to Sys_Prog comment, the copy and assignment operators do not have implementation, IAW the C++ standard.
IAW the C++ standard, they're declared private in the parent class declaration, and have no implementation defined.
IAW the C++ standard, they're declared private in the parent class declaration, and have no implementation defined.
If you really need to copy the stream you could use a temporary buffer to transfer the data from one stream to the other.
dissregard my last comment ... it is wrong
ASKER
I will get the error message later today. It is basically saying that the class does not have a copy or assignment constructor. It is very unlikely that objects of this class would be copied but the classes built on top of my base class have member variables and that is why the copy/assignment operators are being coded.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Which errors do you get?
Cheers,
Stefan