???? Item 1-Deep copy experience

Source: Internet
Author: User

"Project 1-deep copy Experience"

(1) Read the following procedure to make up for outstanding comments

#include <iostream> #include <cstring>using namespace Std;class a{private:    char *a;public:    A (char *AA)    {        a = new Char[strlen (AA) +1];  (a) The significance of such treatment lies in: _________ eliminate the wild pointer __________________        strcpy (A, AA);  (b) The relationship between data member A and form parameter AA: ________ assigns AA value to a______________________    }    ~a ()    {        delete []a;   (c) The significance of this process is that  ____________ saves space and removes memory _____________    }    void output ()    {        cout<<a <<endl;}    ; int main () {    A A ("Good Morning, Code monkeys!");    A.output ();    A B ("Good Afternoon, codes!");    B.output ();    return 0;}


???? Item 1-Deep copy experience

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.