I have a constructor for my class: class(ofstream & o). I want to set my class variable ofstream out. The problem is I can’t use out = o without getting an error.
I have a constructor for my class: class(ofstream & o) . I want to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you’d do is something like:
This will work, and internally you can use
outas usual.In your question, you say
ofstream out. You cannot “copy” file streams, so you cannot sayout = ounlessoutis a reference.