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

What is abstraction encapsulation?

0 Answers  


how can we design a magic square in c++?or suggest me the basic idea of it.

3 Answers  


Can private class be inherited?

0 Answers  


What is Virtual Keyword?

9 Answers   IBM, NA,


What is virtual Function.

1 Answers   Wipro,






what is the use of classes in c++;

2 Answers   HCL,


• What are the desirable attributes for memory managment?

0 Answers  


Why do we use oop?

0 Answers  


create a class complex having real and imaginary part of a complex no. as a data member. overload the binary operators(+,- and *) to perform the operations on complex no. objects. overload binary operator using friend function.

2 Answers   CTS, Delhi University,


What is use of overloading?

0 Answers  


what is the difference between class and structure in C++?

9 Answers   Aspire, IBS, TCS,


i^=j; j^=i; i^=j; value of i,j

1 Answers  


Categories