Interviewer And Interviewee Guide

C++ Virtual Functions Interview Question:

Can you please explain the difference between Overloading and Overriding?

Submitted by: Administrator
Overriding of functions occurs when one class is inherited from another class. Overloading can occur without inheritance.
Overloaded functions must differ in function signature ie either number of parameters or type of parameters should differ. In overriding, function signatures must be same.
Overridden functions are in different scopes; whereas overloaded functions are in same scope.
Overriding is needed when derived class function has to do some added or different job than the base class function.
Overloading is used to have same name functions which behave differently depending upon parameters passed to them.
Submitted by: Administrator

Read Online C++ Virtual Functions Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.