Link to home
Start Free TrialLog in
Avatar of andrewmchorney
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
Avatar of stefan73
stefan73
Flag of Germany image

Hi Andrew,

Which errors do you get?

Cheers,
Stefan
SOLUTION
Avatar of Sys_Prog
Sys_Prog
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Axter
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.

Avatar of Mafalda
Mafalda

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
Avatar of andrewmchorney

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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial