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 are two types of polymorphism?
what are the realtime excercises in C++?
Explain the concepts involved in Object Oriented programming.
Can we have inheritance without polymorphism?
The IT giant Tirnop has recently crossed a head count of 150000 and earnings of $7 billion. As one of the forerunners in the technology front, Tirnop continues to lead the way in products and services in India. At Tirnop, all programmers are equal in every respect. They receive identical salaries and also write code at the same rate. Suppose 14 such programmers take 14 minutes to write 14 lines of code in total. How long will in take 5 programmers to write 5 lines of code in total ?
how to find no of instances of an object in .NET?
What is the renewal class?
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; a.x = 22; int c = a.x; int *b = new int; cout << c; return 0; } option: No output 0 22 -(11) Will not compile
What is design patterns in C++?
Tell me the scenario,Where we can use interfaces or Abstract class.And What is the difference between interfaces and abstract class?
Can an interface inherit a class?
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.