What is the output of this program?
#include <iostream>
using namespace std;
class sample1
{
float i, j;
};
class sample2
{
int x, y;
public:
sample2 (int a, int b)
{
x = a;
y = b;
}
int result()
{
return x + y;
}
};
int main ()
{
sample1 d;
sample2 * padd;
padd = (sample2*) &d;
cout < result();
return 0;
}
a) 20
b) runtime error
c) random number
d) c or b
Submitted by: Murtazad) c or b
Submitted by: Murtaza
Submitted by: Murtaza
Read Online C++ Operator Overloading Job Interview Questions And Answers
Top C++ Operator Overloading Questions
☺ | Pick the other name of operator function. |
☺ | What is overloading template? |
☺ | Can you please explain the difference between overloaded functions and overridden functions? |
☺ | Explain overloading unary operator? |
☺ | Can you please explain function overloading? |
Top C Plus Plus Language Categories
☺ | C++ Pointers & Functions Interview Questions. |
☺ | C++ Operator Overloading Interview Questions. |
☺ | C++ Exception Handling Interview Questions. |
☺ | C++ Virtual Functions Interview Questions. |
☺ | C++ Template Interview Questions. |