Copy* User::Buy(Book* book) { RoleManage::Valid(this, Role::Guest); if (book->Price() > money) throw OperationFail("You have no enough money"); Copy* re = Core::BookMng->books.FetchCopy(book); if (!re) throw OperationFail("Can't buy the book, books has already sell out."); Core::BookMng->books.Remove(re); AddCopy(re); money -= book->Price(); return re; }
/**--------------------------------------------------------------------------<BR> C2DLineBaseSet::MakeCopy \brief Makes a copy of the other set. <P>---------------------------------------------------------------------------*/ void C2DLineBaseSet::MakeCopy( const C2DLineBaseSet& Other) { DeleteAll(); AddCopy(Other); }
void User::Add(Book* book, int cnt) { RoleManage::Valid(this, Role::Admin); for (int i = 0; i < cnt; ++i) AddCopy(&Copy(book)); }
/**--------------------------------------------------------------------------<BR> C2DPolygonSet::MakeCopy \brief Makes a copy of the set provided. <P>---------------------------------------------------------------------------*/ void C2DPolygonSet::MakeCopy( const C2DPolygonSet& Other) { DeleteAll( ); AddCopy(Other); }