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?
Answer Posted / 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 |
Post New Answer View All Answers
Why is polymorphism used?
write a program to find 2 power of a 5digit number with out using big int and exponent ?
Why do we use encapsulation in oops?
What is abstract class in oops?
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).
What is encapsulation selenium?
What is inheritance write a program to show use of inheritance?
What is difference between inheritance and polymorphism?
Why is encapsulation used?
What are the benefits of interface?
How is class defined?
How many human genes are polymorphic?
What is the oops and benefits of oops programming?
What does enum stand for?
What is static in oop?