OVERLOADING UNARY MINUS (-) USING OPERATOR FUNCTION AS FRIEND FUNCTION||C++ PROGRAMMING -Lecture--29

Опубликовано: 30 Сентябрь 2024
на канале: t v nagaraju Technical
858
15

To overload unary minus (-) operator using friend function write the normal function which takes argument as object and make it as friend to the class.
The operator function of unary minus (-) using a friend function is:
void operator -(Class-name &object) {
object.value = -object.value;
}
The friend function call is to be made when it is used as -object; and the system will call like operator operator -(object);

See Complete Playlists:

Object Oriented Programming through C++:

https://www.youtube.com/playlist?list...

For Material
http://supportprogramming.blogspot.co...

Programs on c:

https://www.youtube.com/playlist?list...


C - Programming

https://www.youtube.com/playlist?list...

Programs on c:

https://www.youtube.com/playlist?list...

Technical Mcqs:

https://www.youtube.com/watch?v=Fxgt5...

TOC/Flat:

https://www.youtube.com/playlist?list...


Design and analysis of algorithms:
https://www.youtube.com/playlist?list...

python:
https://www.youtube.com/playlist?list...

Data Structures:
https://www.youtube.com/playlist?list...

Advanced Data Structures:

https://www.youtube.com/playlist?list...

Machine Learning:
https://www.youtube.com/playlist?list...

Operating Systems:
https://www.youtube.com/playlist?list...

Java Programming:

https://www.youtube.com/playlist?list...

Network Security:

https://www.youtube.com/playlist?list...

C++:
https://www.youtube.com/playlist?list...

Programs on c:

https://www.youtube.com/playlist?list...

Computer Graphics:

https://www.youtube.com/playlist?list...