Paskaitų konspektai - Matematikos ir Informatikos fakultetas ...
Paskaitų konspektai - Matematikos ir Informatikos fakultetas ...
Paskaitų konspektai - Matematikos ir Informatikos fakultetas ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Food<br />
name :string<br />
Clone()<br />
getName()<br />
getPrice()<br />
print()<br />
getProfit()<br />
addSelling()<br />
getSellingCount()<br />
getSelling()<br />
1 N<br />
Selling<br />
date :string<br />
itemCount :int<br />
itemPrice :double<br />
getProfit()<br />
print()<br />
N<br />
foodList<br />
CompositeFood<br />
addFoodCopy()<br />
getFoodCount()<br />
getFood()<br />
clone()<br />
getPrice()<br />
print()<br />
PrimitiveFood<br />
price :double<br />
clone()<br />
getPrice()<br />
sellingList<br />
Mūsų klasių hierarchijoje bendriausia maisto produkto sąvoką nusako klas÷ Food.<br />
Joje yra duomenys <strong>ir</strong> metodai būdingi visiems maisto produktams:<br />
// food.h<br />
class Food<br />
{<br />
private:<br />
std::string name;<br />
std::vector sellings;<br />
public:<br />
Food (const std::string& name);<br />
Food (const Food& food);<br />
v<strong>ir</strong>tual Food* clone () const = 0;<br />
std::string getName () const {return name;}<br />
v<strong>ir</strong>tual double getPrice () const = 0;<br />
v<strong>ir</strong>tual void print (const std::string& margin = "") const;<br />
double getProfit<br />
() const;<br />
};<br />
void addSelling (Selling* selling);<br />
int getSellingCount () const {return sellings.size();}<br />
Selling* getSelling (int i) {return sellings[i];}<br />
Rodykl÷ su dideliu baltu trikampiu viename gale žymi paveld÷jimo sąryšį. Klas÷s<br />
46