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

Iam doing my project on instant messaging , if you any new ideas regarding this project ,please suggest it?

2 Answers  


suppose A is a base class and B is the derved class. Both have a method foo which is defined as a virtual method in the base class. You have a pointer of classs B and you typecast it to A. Now when you call pointer->foo, which method gets called? The next part of the question is, how does the compiler know which method to call?

3 Answers   EA Electronic Arts,


You attempt to query the data base with this command: SELECT name, salary FROM employee WHERE salary=(SELECT salary FROM employee WHERE last name='Wagner' OR dept no=233) Choose most appropriate option from the following: 1)Sub-queries are not allowed in the where clause. 2)a multiple row sub-query used with a single row comparison operator. 3)a single row query is used with a multiple row comparison operator.

10 Answers   Zycus Infotech,


What is the main feature of oop?

0 Answers  


write a C++ program for booking using constructor and destructor.

0 Answers   HAL,






What is the difference between declaration and definition?

20 Answers   IBS,


We have a scale and 7 balls. 1 ball is heavier than all the rest. How to determine the heaviest ball with only 3 possible weighing attempts?

8 Answers   IBM, Sage, Vertex,


Polymorphism with an example?

8 Answers   Accenture, emc2,


sir plz send me a set of questions that been frequently held in written examination during campus selection.

0 Answers   TCS,


what is a class

6 Answers  


What is abstraction encapsulation?

0 Answers  


What is encapsulation selenium?

0 Answers  


Categories