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 it is called runtime polymorphism?
What are the benefits of polymorphism?
What is encapsulation in oops?
Can bst contain duplicates?
How Do you Code Composition and Aggregation in C++ ?
What are properties in oop?
What is and I oop mean?
Templates mean
What is encapsulation in oop?
What are the two different types of polymorphism?
Why do we use class?
What does and I oop and sksksk mean?
What is coupling in oops?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?
How do you define a class in oop?