Exercises 4 (280) 1, Create a Text class that contains a string object to hold the text of a file. Give it two constructors a default constructor and a constructor that takes a string argument that is the name of the file to open. When the second constructor is used, open the file and read the contents into the string member object. Add a member function contents()to return the string so(for example) it can be printed. In main(), open a file using Text and print the contents 2, Create a new version of the Stack class that contains the default constructor as before, and a second constructor that takes as its arguments an array of pointers to objects and the size of that array. This constructor should move through the array and push each pointer onto the Stack, Test your class with an array of string
Exercises 4 (280) 1、Create a Text class that contains a string object to hold the text of a file. Give it two constructors: a default constructor and a constructor that takes a string argument that is the name of the file to open. When the second constructor is used, open the file and read the contents into the string member object. Add a member function contents( ) to return the string so (for example) it can be printed. In main( ), open a file using Text and print the contents. 2、Create a new version of the Stack class that contains the default constructor as before, and a second constructor that takes as its arguments an array of pointers to objects and the size of that array. This constructor should move through the array and push each pointer onto the Stack. Test your class with an array of string