while cascading right shift operator we are returning cout object using ‘&’ shouldn’t we use ostream* pointer
Operator overloading linked list
Share the code from which you are taking reference from it.
actually that was in video of linked list operator overloading section
ostream class has protected constructors due to which we are not allowed to create any new object that is why u will always see & operator(by using this operator we pass same object instead of creating its copy) with ostream and istream class.
okay okay got it thankyou
just one general doubt if a function return type is returning pointer to an array so I can also return address of that array using’&’ right ? I know its a silly doubt but still
Yes you can, if your function is of this type.
int * function()
It’s just you are returning starting point of a array address
1 Like