Question: C++ ONLY PLEASE I have a header file i need to make. can i get some help with it please? Here is what is request

C++ ONLY PLEASE

I have a header file i need to make. can i get some help with it please?

Here is what is request from the assignment.

------------------------------------------------------------------------------------------------------------------------------------------------

Text class

Attributes

  • textArray a pointer to a constant character array
  • textLength an integer representing the number of characters stored in the textArray

Functions

Function Name: Text (constructor)

  • Parameters: Send a pointer to a constant character array or a string literal to this function
  • Purpose: called automatically when Text object is created, dynamically allocates a character array which contains the character array passed to the function.
  • Specifications: dynamically allocate a new character string the size of the string passed to this function plus one (for the null terminator). Then, copy the text sent as an argument to this constructor to the new dynamically allocated c-string. Then, set the textArray attribute to this newly created c-string.

Function Name: ~Text (destructor)

  • Purpose: release dynamically allocated memory for the c-string in the Text object
  • Specifications: release the memory for the c-string pointed to by textArray
  • Prints a message: Text destructor: Released memory for textArray.

Function Name: displayText

  • Parameters: none
  • Returns: none (void)
  • Purpose: print the c-string (textArray) to the screen

Function Name: getText (accessor function)

  • Parameters: none
  • Returns: pointer to a constant character array

Function Name: getLength (accessor function)

  • Parameters: none
  • Returns: the length of the string

What is confusing me is when it says text objects. i got about this far and im am not sure what it means or if i have anything correct to begin with. please help!

C++ ONLY PLEASE I have a header file i need to make.

#ifndef TEXT_H #define TEXT H #include #include #include using namespace std; - class Text private: const char *textArray; int textLength; public: Text (char textArray) - L#endif

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!