任鳥(niǎo)飛C++逆向安全從零基礎(chǔ)到進(jìn)階
2023-02-03 13:24 作者:666好聽(tīng)的名字 | 我要投稿
Str類源碼
#include<iostream>#include<string.h>#include<vector>usingnamespacestd;classStr {public:char* str;? ? Str(charvalue[]) {cout<<"Ordinary constructor"<str = (char*)malloc(len +1);memset(str,0, len +1);strcpy(str, value);? ? }//拷貝構(gòu)造函數(shù)Str(constStr& s) {cout<<"copy constructor"<
代碼1
main?函數(shù)中,不使用?move?語(yǔ)義,會(huì)調(diào)用拷貝構(gòu)造函數(shù)
標(biāo)簽: