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
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 |
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 |
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 |
Can we have inheritance without polymorphism?
design class for linked list and include constructor,destructor,insert option. node of form struct node { int data; struct node &ptr; }
what is polymorphism?
why c++ is called OOPS? waht is inherutance? what is compiler?
Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}
Why is encapsulation used?
Can enum be null?
Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.
what are the ways in which a constructors can be called?
What is polymorphism what is it for and how is it used?
WHY FUCTION OVERLOADING DOSENOT RETURN A RETEN TYPE
can you give the dynamic polymorphism types?