I was stuck writting a program as i was confused about operator overloading but your video fixed my problem and I fully understood operator overloading. THANK YOU SO MUCH!
@nullifier_7 ай бұрын
so in short: operator overloading is really telling a class how their objects should behave when they are put along into operations.
@lradhakrishnarao9022 жыл бұрын
Why did you use const keyword in the overloaded operator?
@PortfolioCourses2 жыл бұрын
Great question! :-) It's 'const' because we're not going to change the "operand". We return a new number in the case of + and a bool in the case of ==, but in either case, we will not change the operand so we make it const.
@sabaresand7309 Жыл бұрын
@@PortfolioCourses Thanks for this clarification, because I thought 'const' was a mandatory one
@دلشادزهيرАй бұрын
Thank you from Iraq
@benvingarten3674 Жыл бұрын
Hey, great video, what would happen if you would write: Number c = 4 + a; now the "this" object is 4 and not an instance of the Number class. how would you write the operator + then?
@cheeseboi974011 ай бұрын
You would recieve an error, because the parameter is defined as an instance of the Number class, and if you wanted it to work like that you would need to define another overload.
@mongraal22722 жыл бұрын
Sir can u plz do a video how Read an array of structs in C from a file
@PortfolioCourses2 жыл бұрын
I agree this is a good idea, it's on my 'todo list', one day I will make a video like this. :-)
@PortfolioCourses2 жыл бұрын
Here's a video I just made on reading and writing an array of structs from a binary file: kzbin.info/www/bejne/ZoTOlXSli9-Kps0. One day I will make a vide on reading and writing an array of structs from a text file too.