- 1

operator overloading

Consider a scenario of a shop that deals in stationary items like books, pencils, pen, geometry boxes ,etc. for example ,Suppose the owner have ordered 3 boxes of pen , 4 boxes of pencils, 10 geometry boxes , 20 boxes of notebooks. So now his inventory consist of all these things. Whenever a customer visits , he buys something from the shop hence owner’s inventory will be reduced. Show this scenario by overloading predecrement (−−) operator using friend function. For the above scenario you have to create a class inventory , You have to take the input as number of boxes of all stationary items either by using a constructor or using a getdata function, then as soon as the boxes of respective items are being sold you have to reduce that many items from the inventory using operator overloading . And finally display the remaining inventory details by using a display function .

4th Sep 2021, 11:52 PM
Pruthviraj Suryawanshi
Pruthviraj Suryawanshi - avatar
1 Odpowiedź
+ 3
Could you please post your attempt with your question and detail where you are having the problem. Otherwise it looks like homework
5th Sep 2021, 12:36 AM
Rik Wittkopp
Rik Wittkopp - avatar