+ 5

is there a difference between overloading and overriding?and can destructor be overloaded?

Destructor in CPP

12th Mar 2017, 10:31 AM
Edwin Bello
Edwin Bello - avatar
5 odpowiedzi
+ 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.
12th Mar 2017, 12:26 PM
Stark
Stark - avatar
+ 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.
31st Mar 2017, 8:59 AM
Giriraj Nagar
Giriraj Nagar - avatar
+ 2
destructor can't be overloaded bcoz it does not have arguments
16th Mar 2017, 3:19 PM
sagar chauhan
sagar chauhan - avatar
+ 1
yes thre is a diffrce.destructor can't b overloaded.
12th Mar 2017, 11:19 AM
Mayuri Pandey
Mayuri Pandey - avatar
0
Almost any built-in function can be overridden to do whatever you want
12th Mar 2017, 10:54 PM
Josh
Josh - avatar