Technical Interview

Home
Added Recently
Data Structures
Puzzles
Google & Microsoft
C/C++ Questions
Java Interview Questions
Quantitative Problems
Algorithms
Featured Articles
Amazon Interview Question
Compaq Interview Question
Technical Interview
Interview Process
Introduction Questions
Object Oriented
Google Pages
Fundamental Questions
Resume Tips
Links
Contact Us
Submit Question/Answer

Can you overload a function with the return type?

What is the output of the program below? Why?
Class A
{
public:
void func();
};
class B:pubic A
{
void func(int a);
};
int main()
{
B derv;
derv.func();
}

 

The output will be a compile error because B doesn't know the definition of func().

To make this program run . Rewrite it as:


Class A
{
public:
void func();
};
class B:pubic A
{
using A::func();
void func(int a);
};
int main()
{
B derv;
derv.func();
}