Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@anoop-kumar-GDGRCn • Oct 13, 2014
Yes.. Method overloading is compile time as we are passing different argument.
public void getEmpName(int empId) { ...... } public void getEmpName(String empName) { ...... } public void getEmpName(int empId, String empName) { ...... }and in method overriding is same signature from parent and subclass. so, if you use interface based programming while execution only it will be decided as runtime.
Now coming to your question, I see stackoverflow discussion but IMO overloading is polymorphism. If you see the implementation of System.out.println method there are 10 implementation. Now as a user just use the method and compare with the definition of polymorphism. If it is fulfilling the criteria then yes, overloading is a polymorphism.
polymorphism means that some code or operations or objects behave differently in different contexts.
#-Link-Snipped-#.
Some say overloading is ad-hoc but as per definition, if code is behaving differently at different scenario then its polymorphism. -
@micheal-john-l1fIn3 • Oct 14, 2014
Method overload is compile time and
Method overriding is run-time polymorphsim