Question d’entretien chez BairesDev

What's the difference between overloading and overriding?

Réponse à la question d'entretien

Utilisateur anonyme

18 déc. 2018

Overloading: you have different methods or functions with the same name. At compile time the compiler chooses which one to apply based on the types of the passed arguments. Overriding: A base class has a method and a derived class redefines it with the same signature. The decision on which to use might happen at compile time or at dynamically runtime if the type of the object is only known then (dynamic dispatch).