Slide 20
Slide 20 text
コンストラクタ・デストラクタ
void ctorClassAnimal(classAnimal *this, enumAnimalType type, funcSay *say) {
this->type = type;
this->funcSay = say;
}
void ctorClassDog(classDog *this) {
ctorClassAnimal((classAnimal *)this, enumAnimalTypeDog, funcBark);
this->funcRun = funcRun;
}
classDog * newClassDog() {
classDog *ptr = (classDog *)malloc(sizeof(classDog));
if(ptr) {
ctorClassDog(ptr);
}
return ptr;
}