In C++   Define a class called textLines that will be used to store a list of lines of text (each line can be specified as a string). Use a dynamic array to store the list.  In addition, you should have a private data member that specifies the length of the list.  Create a constructor that takes a file name as parameter, and fills up the list with lines from the file.  Make sure that you set the dynamic array to expand large enough to hold all the lines from the file.  Also, create a constructor that takes an integer parameter that sets the size of an empty list.   Write member functions to: remove and return the last line from the list add a new line onto the end of the list, if there is room for it, otherwise print a message and expand the array empty the entire list return the number of lines still on the list take two lists and return one combined list (with no duplicates) copy constructor to support deep copying remember the destructor!

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter10: Object-oriented Programming
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

In C++

 

Define a class called textLines that will be used to store a list of lines of text (each line can be specified as a string).

Use a dynamic array to store the list.  In addition, you should have a private data member that specifies the length of the list. 

Create a constructor that takes a file name as parameter, and fills up the list with lines from the file.  Make sure that you set the dynamic array to expand large enough to hold all the lines from the file.  Also, create a constructor that takes an integer parameter that sets the size of an empty list.

 

Write member functions to:

  1. remove and return the last line from the list
  2. add a new line onto the end of the list, if there is room for it, otherwise print a message and expand the array
  3. empty the entire list
  4. return the number of lines still on the list
  5. take two lists and return one combined list (with no duplicates)
  6. copy constructor to support deep copying
  7. remember the destructor!
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage