I am ex fortran lover, and wanna impress myself in messing with c++ :) ... Though overlwelmed given the amount of stuff to learn, your courses are clear... and for that, BIG thank you!
The friend function for + operator overloading has compiling error, error C2440: 'return': cannot convert from 'Counter' to 'Counter'. I have to modify it: Counter operator+(Counter c1, Counter c2) { Countera; a.inputValue = c1.inputValue + c2.inputValue; return a; } I used cpp file and header file.
The friend function can be any function? Where should it be defined? I mean, can it be a member (private or protected) of class A and friend of class B?
I have a much better understanding friend functions and their use in operator overloading. Thank you!
You're welcome Jeff, I'm very glad to hear that it helped you! 🙂
Hands down the best channel out there.
Thankyou!
You're welcome, and thanks for the support! :-)
I am ex fortran lover, and wanna impress myself in messing with c++ :) ...
Though overlwelmed given the amount of stuff to learn, your courses are clear... and for that, BIG thank you!
Such a great tutorial! You saved the day!
You’re welcome, I’m glad it was helpful for you! :-)
Amazing explanation 🌹
Subscribed
Thank you! :-)
The friend function for + operator overloading has compiling error, error C2440: 'return': cannot convert from 'Counter' to 'Counter'. I have to modify it:
Counter operator+(Counter c1, Counter c2)
{
Countera;
a.inputValue = c1.inputValue + c2.inputValue;
return a;
}
I used cpp file and header file.
Thanks once again Professor! So this->count and using count directly are the same thing, right?
great job sir
Thank you Bilal! :-)
The friend function can be any function? Where should it be defined? I mean, can it be a member (private or protected) of class A and friend of class B?
Thanks
i have subscribed
Awesome, welcome aboard! :-)
hi what IDE do you use?