Resume* Clone() { Resume* pResume = new Resume; pResume->SetPersonInfo(name_, sex_, age_); pResume->SetWorkExperience(workexperience_.get_company(), workexperience_.get_worktime()); return pResume; }
int main() { Resume *linResume = new Resume("Lincoln"); linResume->setAge("23"); linResume->setSex("M"); puts(linResume->toString()); Resume *linResume2 = linResume->clone(); linResume2->setAge("22"); puts(linResume2->toString()); return 0; }
void PrototypeMain::main(std::string args[]) { Resume* linResume = new Resume("Lincoln"); linResume->setAge("23"); linResume->setSex("M"); //JAVA TO C++ CONVERTER TODO TASK: There is no native C++ equivalent to 'toString': puts(linResume->toString()); Resume* linResume2 = linResume->clone(); linResume2->setAge("22"); //JAVA TO C++ CONVERTER TODO TASK: There is no native C++ equivalent to 'toString': puts(linResume2->toString()); }
int main(int argc, char** argv, char** env) { Resume rs; rs.SetPersonInfo("默默", "女", 21); rs.SetWorkExperience("新浪", "2"); rs.PrintInfo(); Resume* pResume = rs.Clone(); pResume->SetPersonInfo("vic", "男", 22); pResume->SetWorkExperience("搜狗", "2"); pResume->PrintInfo(); delete pResume; return 0; }
void testPrototype() { std::cout << "-------------------test Prototype[start]-----------------------" << std::endl; Resume *liqiResume = new Resume("Liqi"); liqiResume->setSex("Male"); liqiResume->setWorkExperience("2011 - 10 -02", "Central South University"); liqiResume->display(); Resume* wr = (Resume*)liqiResume->clone(); wr->display(); wr->setName("HR"); wr->setSex("Female"); wr->display(); wr->setWorkExperience("2007 - 10 - 01", "Beijin"); wr->display(); delete liqiResume; std::cout << "-------------------test Prototype[end]-------------------------" << std::endl; }