Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface IQuantity
- {
- void ReturnQuantityLiter();
- void ReturnQuantityKilo();
- }
- abstract class TypeProductsInBag
- {
- public abstract void CalculateTypeProductsInBag(int quantity);
- }
- class FruitsInBag:TypeProductsInBag, IQuantity
- {
- public int NumberFruitInBag { get; set; }
- public override void CalculateTypeProductsInBag(int quantity)
- {
- NumberFruitInBag += quantity;
- }
- public void DisplayQuantityKilo()
- {
- //wyświetl ilość kilogramów
- }
- //metoda DisplayQuantityLiter nie pasuje więc jest nie używana w tej klasie
- public void DisplayQuantityLiter()
- {
- throw new NotImplementedException();
- }
- }
- class DrinksInBag : TypeProductsInBag, IQuantity
- {
- public int NumberDrinksInBag { get; set; }
- public override void CalculateTypeProductsInBag(int quantity)
- {
- NumberDrinksInBag += quantity;
- }
- public void DisplayQuantityLiter()
- {
- //wyświetl ilość litrów
- }
- //metoda DisplayQuantityKilo nie pasuje więc jest nie używana w tej klasie
- public void DisplayQuantityKilo()
- {
- throw new NotImplementedException();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement