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!
#ifndef TEXT_H #define TEXT H #include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started