int main() { int i; Teddy Ted; LittlePony Pony; i = 0; Object **tab; tab = MyUnitTests(); std::cout << "----------------BY TAB---------------" << std::endl; std::cout << "All information by tab of Bears " << *(Teddy *)tab[0] << std::endl; std::cout << "All information by tab of Pony " << *(LittlePony *)tab[1] << std::endl; while (i < 2) { if (tab[i]->getType() == LITTLE_PONY) { Pony = *(LittlePony *)tab[i]; std::cout << "It 's a poney !!" << std::endl; std::cout << Pony << std::endl; } else if (tab[i]->getType() == TEDDY) { Ted = *(Teddy *)tab[i]; std::cout << "It's a bear !!" << std::endl; std::cout << Ted << std::endl; } else std::cout << "Dafuck ?" << std::endl; i++; } return (0); }
int main(void) { Object **obj = MyUnitTests(); LittlePony *lp = (LittlePony *)obj[0]; Teddy *t = (Teddy *)obj[1]; ITable *theTruc = createTable(); const std::string **myTab; theTruc->Put(new Teddy("Beer")); theTruc->Put(new Teddy("Pokemon")); theTruc->Put(new LittlePony("Jeremy")); theTruc->Take(1); myTab = theTruc->Look(); int i = 0; while (myTab[i]) { std::cout << *myTab[i] << std::endl; i++; } lp->isTaken(); t->isTaken(); obj = new Object*[4]; obj[0] = new Teddy("bisounours"); obj[1] = new Box; obj[2] = new GiftPaper; obj[3] = NULL; std::cout << obj[1]->getTitle() << std::endl; std::cout << obj[2]->getTitle() << std::endl; MyUnitTests(obj); return (0); }