#include<stdio.h>
#pragma warning(disable:4996)
class CSuper{
public:
void human(void);
void bird(void);
void input(void);
void output(void);
CSuper() :atk(0){
printf("ATKは%d\n", atk);
};
CSuper(int _val) :atk(_val){
printf("atk入力\n");
};
private:
int atk;
};
void CSuper::human(void){
printf("人\n");
}
void CSuper::bird(void){
printf("鳥\n");
}
void CSuper::input(void){
scanf("%d", &atk);
}
void CSuper::output(void){
printf("ATK:%d\n", atk);
}
int main(void){
CSuper *Obj;
Obj = new CSuper;
printf("1(人):2(鳥)\n");
int count;
scanf("%d", &count);
if (count == 1)
Obj->human();
if (count == 2)
Obj->bird();
printf("初期化? 1はい 2いいえ\n");
int suu;
scanf("%d", &suu);
if (suu == 1){
CSuper *pt1 = new CSuper(0);
Obj->input();
Obj->output();
}
if (suu == 2){
CSuper *pt2 = new CSuper;
}
return 0;
}
実行するとATKは0と呼ばれてしまいます。呼ばれないようにどうすればいいか教えてください。