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 |
what is runtime polymorphism? For the 5 marks.
What is difference between abstraction and encapsulation?
What is the purpose of enum?
Out of 4 concepts, which 3 C++ Follow?
who is the father of OPPS
Precompilation ?
DIFFRENCE BETWEEN STRUCTURED PROGRAMING AND OBJCET ORIENTED PROGRAMING.
Program to print 0 to 9 in cross order
Hi All, I am new to programming and want to know how can i write a code to take input of 2 numbers from user and swap it without using a temp variable?
What does it mean when someone says I oop?
What type of Job you are providing?
What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?