Skip to content

Instantly share code, notes, and snippets.

@coligne
Last active March 29, 2018 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coligne/55f200f1c8776dfa82f5ebc5014ac854 to your computer and use it in GitHub Desktop.
Save coligne/55f200f1c8776dfa82f5ebc5014ac854 to your computer and use it in GitHub Desktop.
コピーコンストラクタの意義
//コピーコンストラクタ,配列のすべての値を逐次代入する.
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