I hv a same function name,arguments in both base class and
dervied class, but the return type is different. Can we call
this as a function overloading? Explain?

Answers were Sorted based on User's Feedback



I hv a same function name,arguments in both base class and dervied class, but the return type is di..

Answer / ravi kumar noneria

No,
if two functions with same name has either diff no of
argument or same no of arguments but different type is
called function overloading not return type.

Is This Answer Correct ?    5 Yes 0 No

I hv a same function name,arguments in both base class and dervied class, but the return type is di..

Answer / vivek

Because the function caller has the option of ignoring the function return value (as demonstrated below), overloading based on function return value is not considered as a valid case to be supported by the language.

class Demo
{

int function(){ return 1; };

};

int main()
{

Demo demoObject;

demoObject.function();

return 0;
}

Is This Answer Correct ?    2 Yes 0 No

I hv a same function name,arguments in both base class and dervied class, but the return type is di..

Answer / pankaj shinde

No.
for overloading two methods should be in same class
and not in base & derived class

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More OOPS Interview Questions

can we make game by using c

1 Answers   SmartData,


What is polymorphism give a real life example?

0 Answers  


In multiple inheritance , to create sub class object , is there need to create objects for its superclasses??? in java and c++ both. Actually i have some information that is , all available members from its superclasses , memory created in subclass obj , so no need to create object for its superclasses...??? Thanks in Advance

1 Answers  


In which cases you use override and new base?

2 Answers  


What are the access specifiers avaible in c++?

4 Answers  


What is the difference between inheritance and polymorphism?

0 Answers  


What are virtual classes?

0 Answers  


WILL I GET A guaranteed JOB AFTER DOING bsc()IT) and GNIIT from an NIIT CENTRE??

21 Answers   Biocon, MIT, NIIT,


can you give real time example for polymarphism

5 Answers   TCS,


what is a virtual class?

5 Answers   Cap Gemini, IBM, Infosys, Trinity Technologies,


Can enum be null?

0 Answers  


Definition of Object Oriented Programming in single line?

33 Answers   Impact Systems, Q3 Technologies, TCS,


Categories