Amazon Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Phone Interview
When two or more different declarations are specified for a "single name" in the "same scope" , that name is said to be overloaded.Overloading always happens in same scope and NOT across scope as in same names in base class/derived class.When overloaded base class method is redefined in derived class, it hides all the overloaded members of base class in scope of derived class
Overriding applies to only to inheritance when a virtual method in base class is redefined in derived class. An overriding virtual function has to match the signature and the return type of the function it overrides(except that return type of a public base can be changed to the type of a derived class)
in overloading functions with same name are used but they have different parameters type or no. for better understanding u may follow this link geeksforgeeks.org/function-overloading-in-c/
- zeroByzero January 11, 2013while overriding is concept in inheritence ,function with same name and parameters are present both in base and child class .