Question
#include <iostream>
using namespace std;
class sample
{
public:
sample()
{
cout << "X::X()" << endl;
}
sample( sample const & )
{
cout << "X::X( X const & )" << endl;
}
sample& operator=( sample const & )
{
cout << "X::operator=(X const &)" << endl;
}
};
sample f()
{
sample tmp;
return tmp;
}
int main()
{
sample x = f();
return 0;
}
a.
X::operator=(X const &)
b.
X::X( X const & )
c.
X::X()
d.
None of the mentioned
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. How to stop your program from eating so much ram?
View solution
Q. Which option is best to eliminate the memory problem?
View solution
Q. What is the size of the heap?
View solution
Q. How to unlimit the size of the stack?
View solution
Q. In linux, how does the heaps and stacks are managed?
View solution
Q. Which is used to pass the large objects in c++?
View solution
Q. What are the essential operators in c++?
View solution
Q. In which direction does the assignment operation will take place?
View solution
Q. Pick out the compound assignment statement.
View solution
Q. What is the associativity of add(+);
View solution
Q. What is the name of | operator?
View solution
Q. Which operator is having the highest precedence in c++?
View solution
Q. subscript operator is used to access which elements?
View solution
Q. How many arguments will the subscript operator will take for overloading?
View solution
Q. Pick out the correct statement.
View solution
Q. What do we need to do to pointer for overloading the subscript operator?
View solution
Q. What do we need to use when we have multiple subscripts?
View solution
Q. What is the use of function call operator?
View solution
Q. Pick out the correct statement.
View solution
Q. What will happen when the function call operator is overloaded?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!