class="article_content clearfix">
class="markdown_views prism-atom-one-dark">
这是头文件
class="prettyprint">class=" hljs cpp">
;
computer {
:
* brand;
price;
:
computer( computer &ct) {
len = (ct.brand) + ;
brand = [len];
strcpy_s(brand,len,ct.brand);
brand = ct.brand;
}
computer( *brand, price) {
len = (brand) + ;
computer::brand = [len];
strcpy_s(computer::brand,len,brand);
}
() {
cnt = ;
cnt++;
<< << brand << << price << <<cnt<<endl;
}
};
这是源文件
class="prettyprint">class=" hljs cpp">
main() {
computer ct1( , );
<< << endl;
ct1. ();
<< << endl;
computer ct2 = ct1;
ct2. ();
<< << endl;
ct1. ();
;
}