Last active
March 29, 2018 12:59
-
-
Save coligne/55f200f1c8776dfa82f5ebc5014ac854 to your computer and use it in GitHub Desktop.
コピーコンストラクタの意義
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//コピーコンストラクタ,配列のすべての値を逐次代入する. | |
Numeric(const Numeric& Num){ | |
int len = Num.length; | |
if(num!=NULL){ | |
delete [] num; | |
} | |
num = new int[length]; | |
int *ptr = Num.num; | |
for(int i = 0;i<length;i++){ | |
num[i] = ptr[i]; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment