Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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



I hv a same function name,arguments in both base class and dervied class, but the return type is di..

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

I hv a same function name,arguments in both base class and dervied class, but the return type is di..

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

I hv a same function name,arguments in both base class and dervied class, but the return type is di..

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

Post New Answer



More OOPS Interview Questions

what is inline function?

3 Answers  


Round up a Decimal number in c++.. example Note = 3.5 is as 4 3.3 is as 3

3 Answers   Accenture, Cognizant, IBM,


What is polymorphism ? Explain with examples

8 Answers   Ness Technologies,


1. Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list)

1 Answers   Nagarro,


Program to read a comment string

1 Answers   IBM,






What is object in oop with example?

0 Answers  


What is oops concept with example?

0 Answers  


can we create and enter the data & hide files using programmes ?

2 Answers   Wipro,


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 ?

6 Answers   TCS,


Give two or more real cenario of virtual function and vertual object

0 Answers   TCS,


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

0 Answers  


What are the data types in oop?

0 Answers  






Categories