Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How is project leadership impacted by our definition of value?

Answered: 1 week ago

Question

2. Do you agree that unions stifle creativity? Why or why not?

Answered: 1 week ago