本文整理汇总了C++中ModelHistory::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelHistory::clone方法的具体用法?C++ ModelHistory::clone怎么用?C++ ModelHistory::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelHistory
的用法示例。
在下文中一共展示了ModelHistory::clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModelHistory
END_TEST
START_TEST ( test_ModelHistory_clone )
{
ModelHistory * mh = new ModelHistory();
ModelCreator *mc = new ModelCreator();
mc->setFamilyName("Keating");
mc->setGivenName("Sarah");
mc->setEmail("[email protected]");
mh->addCreator(mc);
delete mc;
Date * date = new Date(2005, 12, 30, 12, 15, 45, 1, 2, 0);
mh->setCreatedDate(date);
delete date;
fail_unless(mh->getCreatedDate()->getMonth() == 12);
fail_unless(mh->getCreatedDate()->getSecond() == 45);
fail_unless(static_cast <ModelCreator*>(mh->getListCreators()->get(0))->getFamilyName() == "Keating");
ModelHistory* mh2 = static_cast<ModelHistory*>(mh->clone());
fail_unless(mh2->getCreatedDate()->getMonth() == 12);
fail_unless(mh2->getCreatedDate()->getSecond() == 45);
fail_unless(static_cast <ModelCreator*>(mh2->getListCreators()->get(0))->getFamilyName() == "Keating");
delete mh2;
delete mh;
}