What is the main difference between operator overloading and operator overriding in C++?
Some use the latter term to describe what's being done when you defined an own global operator new
or operator delete
. That's because your own definition can replace the default version in the library. The C++ Standard uses the words replaces and displaces for this. Using "override" is a bit confusing because that term is already used for virtual functions being overridden by a function in a derived class.
The term "overloading" is the general term used for defining your own operator functions. This term is used even if no actual overloading happens by the operator function. One way to approach this term is because it "overloads" the built-in meaning of certain operators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With