sir i am unable to understand how the cout<< is working in the main function of the below code which is expalined by sir in the video . As it is taught in the previous videos of class and oops , that << function is not recognised by the class made by us, so we have to overload the operator to write cout<<getmin() or else we have to make print funtion in the class and call it for printing .
Operator overloading doubt in stack class
@tejuschaturvedi0 that function is simply returning an int and you are printing the int.
It would be the same thing if you stored the returned number in some variable and then printed that. eg
int maxval = st.getmax();
cout << maxval;
Clear now?
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.