Programming  >  CODING SOLUTION  >  CSCE 121 Introduction to Program Design and Concepts MyString.cpp. (All)

CSCE 121 Introduction to Program Design and Concepts MyString.cpp.

Document Content and Description Below

Texas A&M University _ CSCE 121 Introduction to Program Design and Concepts MyString.cpp. Implement this source file #include "MyString.h" #include <iostream> using std::ostream, std::iostream; My ... String::MyString(): capacityPriv(1), sizePriv(0), cString(new char[1]{'\0'}){} MyString::MyString(const char* object): capacityPriv(1), sizePriv(0), cString(new char[1]{'\0'}){ size_t n = 0; while( object[n]){ n++; } resize(n); delete[] cString; cString = new char[n+1]; for (size_t i = 0; i <= n; ++i){ cString[i] = object[i]; } //delete[] object; } MyString::MyString(MyString& other): capacityPriv(1), sizePriv(0), cString(new char[1]{'\0'}) { delete[] cString; cString = new char[other.capacity()]; sizePriv = other.length(); capacityPriv = other.capacity(); for (size_t i = 0; i <= other.length(); ++i){ cString[i] = other.cString[i]; }MyString& MyString::operator=(MyString& other){ if (this != &other){ delete[] cString; cString = new char[other.capacity()]; sizePriv = other.length(); capacityPriv = other.capacity(); for (size_t i = 0; i <= other.length(); ++i){ cString[i] = other.cString[i]; } [Show More]

Last updated: 1 year ago

Preview 1 out of 3 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of CSCE 121 Introduction to Program Design and Concepts MyString.cpp. document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$7.00

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

146
0

Document information


Connected school, study & course


About the document


Uploaded On

Apr 28, 2023

Number of pages

3

Written in

All

Seller


Profile illustration for PAPERS UNLIMITED™
PAPERS UNLIMITED™

Member since 4 years

509 Documents Sold

Reviews Received
55
20
8
2
8
Additional information

This document has been written for:

Uploaded

Apr 28, 2023

Downloads

 0

Views

 146

More From PAPERS UNLIMITED™

View all PAPERS UNLIMITED™'s documents »

Recommended For You

Get more on CODING SOLUTION »

$7.00
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·