int main(int argc, char* argv[]) { #if 1 Object* objA = Object_create(); Object* objB = objA->ref(objA); Object* objC = objB->ref(objB); //*/ objA->unref(objA); objA = NULL; objB->unref(objB); objB = NULL; objC->unref(objC); objC = NULL; /*/ objA->destroy(objA); //*/ #else AbstractPlayer* con = NULL; MyPlayer* player = NULL; ChildPlayer* child = NULL; /* The first sample. */ con = ConcretePlayer_create(); if (con->open(con, "Abstract & Concrete") == true) { con->play(con); con->close(con); } if (con->destroy(con) == true) { con = NULL; } /* The second sample. */ player = MyPlayer_create(); if (player->open(player, "This is my player.") == true) { player->play(player); player->pause(player); player->close(player); } if (player->destroy(player) == true) { player = NULL; } /* The third sample. */ child = ChildPlayer_create(); if (child->open(child, "This is Mr. Child.") == true) { child->play(child); child->pause(child); child->play(child); child->setSpeed(child, 1024); child->close(child); } if (child->destroy(child) == true) { child = NULL; } #endif return 0; }