Question: B 1 Given test _ Str . cpp write the corresponding header file and implementation file ( Str . h , Str . cpp )
B Given testStrcpp write the corresponding header file and implementation file Strh Strcpp
testStrcpp
#include
#include Strh
using namespace std;
int main
Str s;
char courseNamecpp;
Str scourseName;
Str ss;
sprint; cpp
sprint; cpp
s s; sprint;
cpp
s; sprint;
dqq
sP; sprint; Pqq
return ;
Hint: use the following information
CONSTRUCTORS Apply memory allocation for each constructor.
First One: An empty constructor: only NULL character, Size:
Second One: Creates a string fills with arr's elements. arr can have different
size.
Third One: Copy constructor. Source string object can have different size.
OPERATORS
Assignment operator. Lefthand side string object can have different size.
Apply memory allocation for the assignment operator
KOM ObjectOriented Programming
Assignment
Preincrement. Increments the elements of the string by one value.
Subscript operator: returns an lvalue through indexing.
OTHER FUNCTIONS
Display the string.
private:
int Size; the Size of the string including NULL.
char str;
the pointer should point the characters of the string NULL.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
