+ 5
is there a difference between overloading and overriding?and can destructor be overloaded?
Destructor in CPP
5 ответов
+ 3
A destructor is a method right? Yeah, but a destructor CANNOT receive or return a parameter so, you definitely can't overload it... Overloading a function or method is just a way to allow it adapt to different parameters passed to it.
+ 3
here overriding means method hiding .it means in case of inheritance when we declare a method into the parent class like same name as child class then it is hidden by the child class method that is called overriding.and overloading means same name of methods but different type or different number of parameters is given.
And we can not overload the destructor.
+ 2
destructor can't be overloaded bcoz it does not have arguments
+ 1
yes thre is a diffrce.destructor can't b overloaded.
0
Almost any built-in function can be overridden to do whatever you want