Question: RecordSet Module Design and code a class named RecordSet that manages a dynamically allocated array of std::strings. Your class keeps track of the number of

RecordSet Module

Design and code a class named RecordSet that manages a dynamically allocated array of std::strings. Your class keeps track of the number of strings currently stored and defines the following member functions:

  • a no-argument default constructor
  • a 1-argument constructor that receives the address of a C-style null terminated string containing the name of a file from which this member function populates the current object. This function
    1. reads the file to count the number of records present (the record delimiter should be a single space ' ')
    2. allocates memory for that number records in the array
    3. re-reads the file and loads the records into the array.
  • a copy constructor
  • a copy assignment operator
  • a destructor
  • size_t size(): a query that returns the number of records stored in the current object.
  • std::string getRecord(size_t): a query that returns the record at the index received as parameter. If the index is invalid, this function should return the empty string.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!