Parameterised constructor

  1. when we are to make an object E, then it using the concept of parametrised constructor, but price is a private member.
  2. what if in this case we pass the value of price which is not acceptable?

hi @Nidhi_Alipuria private members of a class are accessible to the member functions of the class. They are not accessible only outside the class.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.