Consider the following C++ class: class myFile { public: myFile(const char *fname); myFile(); void print(); }; An object of this class opens a file and keeps it open, method print() prints that file's...


Consider the following C++ class:<br>class myFile {<br>public:<br>myFile(const char *fname);<br>myFile();<br>void print();<br>};<br>An object of this class opens a file and keeps it open, method print() prints that file's content<br>to cout, while the constructor closes the file. Provide a complete implementation for this class.<br>Feel free to add data members as you see fit. The constructor must throw an exception if the<br>file cannot be open for reading. Your function main() must provide proper exception handling.<br>

Extracted text: Consider the following C++ class: class myFile { public: myFile(const char *fname); myFile(); void print(); }; An object of this class opens a file and keeps it open, method print() prints that file's content to cout, while the constructor closes the file. Provide a complete implementation for this class. Feel free to add data members as you see fit. The constructor must throw an exception if the file cannot be open for reading. Your function main() must provide proper exception handling.

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here